Write a C program to read through an array of any type. Write a C program to scan through this array to find a particular value.
/*program to scan through this array to find a particular value
programmed by:
Name: Jitendra Kumar Yadav
Roll: 10116
Date: 29 march 2011 */
#include <stdio.h>
#include <conio.h>
void main ()
{
int i,n,index;
int a[] = {1,2,3,4,5,6,7,8};
printf (“Enter a number from 1 to 8\n”);
scanf (“%d”,&n);
for (i=0;i<8;i++)
{
if (n==a[i])
index = i;
}
printf (“%d is at %d index”,n,index);
getch();
}
Comments (1)