check if the number is in the table or not

Solutions on MaxInterview for check if the number is in the table or not by the best coders in the world

showing results for - "check if the number is in the table or not"
Elena
18 May 2016
1#include <stdio.h>
2int main(void) {
3 int i,n,x,y,t[50];
4printf("How long do you want your table? :");
5scanf("%d",&n);
6 for (i=0;i<n;i++){
7printf("enter the %d number :",i+1);
8scanf("%d",&t[i]);
9 }
10printf("enter the number for verify :");
11scanf("%d",&x);
12y=0;
13for (i=0;i<n;i++){
14 if (t[i]==x)
15  y++;
16 }
17 
18  if (y==1){
19    printf("The number is in the table");
20    }
21  else {
22  printf("the number is not in the table");
23  }
24 return 0;
25  }
similar questions
queries leading to this page
check if the number is in the table or not