#include<stdio.h>
void main()
{
int arr[10],i,value,index;
printf("Enter 10 values:\n");
for(i=0;i<10;i++)
scanf("%d",&arr[i]);
printf("\nEnter a value to be searched: ");
scanf("%d",&value);
index = -1;
for(i=0;i<10;i++)
{
if(arr[i]==value)
{
index=i;
break;
}
}
if(index>=0)
printf("Value found in Array at %d location, %d index",index+1,index);
else
printf("Value not found in Array");
}
0 Comments