write a program to accept any number from user and search it in a list of values, if number is found then display a message "number found" other wise display a message number not found
Answers
Answer:
Explanation:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,flag=0;
float s,a[4];
clrscr();
printf("Enter Five numbers:");
for(i=0;i<5;i++)
scanf("%f",&a[i]);
printf("Enter a number to search:");
scanf("%f",&s);
for(i=0;i<5;i++)
if(a[i]==s)
flag=1;
if(flag==1)
printf("\nSearch number found");
else
printf("Search number not found");
getch();
}
Explanation:
Write a program using one dimensional array that accept five
values from the keyboard. Then it should also accept a
number to search. This number is to be searched if it among
the five input values. If it is found, display the message
“Search number is found!” otherwise, display “Search is lost”.
Example:
Enter 5 numbers: 10 15 20 7 8
Enter number to search: 7
Search number is found!
mark this answer as brainliest answer