ShriRam Changed status to publish July 15, 2022
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[100],size,i,search,found;
printf("Enter size of array: ");
scanf("%d", &size);
printf("Enter elements in array: ");
for(i=0; i<size; i++)
{
scanf("%d", &arr[i]);
}
printf("\nEnter element to search: ");
scanf("%d", &search);
found = 0;
for(i=0; i<size; i++)
{
if(arr[i] == search)
{
found = 1;
break;
}
}
if(found == 1)
{
printf("\n%d is found at position %d", search, i + 1);
}
else
{
printf("\n%d is not found in the array", search);
}
getch();
}
ShriRam Changed status to publish July 15, 2022