Find a number

/* this code should ask for 5 numbers input
then locate 1 input to where it was located

ex. 5 4 3 2 1
enter number to be searched:4
*/


#include <stdio.h>
#include <conio.h>
main() {
int num[5];
int find;
int ctr;
clrscr();
printf("enter a list of numbers:");
scanf("%d%d%d%d%d",&amp;num[5]);
printf("enter a number to be Searched:");
scanf("%d",&amp;find);

for(ctr=1;ctr&lt;=5;ctr++)
if(find=num[ctr]);
{
printf("is found in:%d",ctr);
break;
}
getch();
}

comment 0 comments:

Post a Comment

Delete this element to display blogger navbar

 
© C.L.S.T.I. Tutorial | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
Powered by Blogger