Answers for "Check if the number is in the table or not"

C
0

Check if the number is in the table or not

#include <stdio.h>
int main(void) {
 int i,n,x,y,t[50];
printf("How long do you want your table? :");
scanf("%d",&n);
 for (i=0;i<n;i++){
printf("enter the %d number :",i+1);
scanf("%d",&t[i]);
 }
printf("enter the number for verify :");
scanf("%d",&x);
y=0;
for (i=0;i<n;i++){
 if (t[i]==x)
  y++;
 }
 
  if (y==1){
    printf("The number is in the table");
    }
  else {
  printf("the number is not in the table");
  }
 return 0;
  }
Posted by: Guest on July-05-2021

Code answers related to "Check if the number is in the table or not"

Code answers related to "C"

Browse Popular Code Answers by Language