Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Saturday, September 3, 2022

C program to search the given data from the list of element from given array

C program to search the given data from the list of element from given array

#include<stdio.h>

#include<conio.h>

main()

{

int i,n, num,flag=0;

printf("How may number you wnat to enter\n");

scanf("%d",&n);

int arr[n];

printf("Enter %d numbers\n",n);

for(i=0;i<n;i++)

{

scanf("%d",&arr[i]);

}


printf("enter the number you want to search\n");

scanf("%d",&num);

for(i=0;i<n;i++)

  {

  if(num==arr[i])

  {

  flag=1;

  break;

  }

}

  if(flag==1)

  printf("data found");

  else

  printf("data not found");

getch();

}

OUTPUT:



No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages