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!

Answers were Sorted based on User's Feedback



Write a program using one dimensional array that accept five values from the keyboard. Then it shou..

Answer / sreejesh1987

#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();
}

Is This Answer Correct ?    39 Yes 25 No

Write a program using one dimensional array that accept five values from the keyboard. Then it shou..

Answer / pratap

yes

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C++ Code Interview Questions

write a program using virtual function to find the transposing of a square matrix?

0 Answers  


A Binary no. is given, we hav to find it's decimal equivalent.

2 Answers   Microsoft,


write a program that reverses the input number of n.Formulate an equation to come up with the answer.

0 Answers   Satyam,


void main() { int i,j=2; for(i=0;i<3;i++) if(j=i) cout<<"Lotus "; else cout<<"Rose "; } Its result is Rose Lotus Lotus.. How? Explain it?

2 Answers  


A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE OUTPUT: E

1 Answers  






using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.

2 Answers  


write a program to sort 'n' elemnts using bubble sort

1 Answers   IBM,


1.program to add any two objects using operator overloading 2.program to add any two objects using constructors 3.program to add any two objects using binary operator 4.program to add any two objects using unary operator

2 Answers   IBM,


write a program that reads a series of strings and prints only those strings begging with letter "b"

0 Answers  


What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

0 Answers  


write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.

1 Answers  


Deriving time complexity of Binary tree and AVL tree, step by step.

4 Answers   NetApp,


Categories