Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <math.h>
- #define size 10
- void main()
- {
- int i,data[size],v;
- for (i=0;i<size;i++)
- {
- printf("Enter Number[%d]=",i);
- scanf("%d",&data[i]);
- }
- int found = 0; //0 แปลว่า ยังไม่เจอ
- while(found==0)
- {
- printf("Choose Number=");
- scanf("%d",&v);
- for (i=0;i<size;i++)
- {
- if (v==data[i])
- {
- found=1;// เท่ากับ 1 แปลว่า เจอแล้ว
- break;
- }
- }
- }
- printf("answer =%d",i);
- getch();
- }
Add Comment
Please, Sign In to add comment