Find No From Array in C

Find No From Array in C

write a C program to accept 10 integers for 1D array and a number from input device. Check whether user inputted number present in the 1D array or not.

#include<stdio.h>

#include<conio.h>

void main()

{
int arr[10];
int num, i, found = 0;

// Accepting 10 integers for the array
printf("Enter 10 integers for the array:\n");
for (i = 0; i < 10; i++) {
    printf("Enter element %d: ", i + 1);
    scanf("%d", &arr[i]);
}

// Accepting the number to be searched
printf("\nEnter a number to search in the array: ");
scanf("%d", &num);

// Checking if the number is present in the array
for (i = 0; i < 10; i++) {
    if (arr[i] == num) {
        found = 1;
        break;
    }
}

// Displaying the result
if (found) {
    printf("\nThe number %d is present in the array.\n", num);
} else {
    printf("\nThe number %d is not present in the array.\n", num);
}

getch();

}