Guest User

Untitled

a guest
Jun 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <math.h>
  4. #define size 10
  5.  
  6. void main()
  7. {
  8. int i,data[size],v;
  9. for (i=0;i<size;i++)
  10. {
  11. printf("Enter Number[%d]=",i);
  12. scanf("%d",&data[i]);
  13. }
  14. int found = 0; //0 แปลว่า ยังไม่เจอ
  15. while(found==0)
  16. {
  17. printf("Choose Number=");
  18. scanf("%d",&v);
  19.  
  20. for (i=0;i<size;i++)
  21. {
  22. if (v==data[i])
  23. {
  24. found=1;// เท่ากับ 1 แปลว่า เจอแล้ว
  25. break;
  26. }
  27.  
  28. }
  29. }
  30. printf("answer =%d",i);
  31.  
  32. getch();
  33. }
Add Comment
Please, Sign In to add comment