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

How do I store linked list datas into an array?

1 Answers  


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

0 Answers  


. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of data in columns of the 3x3 (three by three) array variable n[3][3].

2 Answers   IBM,


write a program to perform generic sort in arrays?

0 Answers  


Assume in University Every student in university as entity, prepare a class for student that store the roll no, name, dob of student, and make funtion of deletion, manipulation, addition of student record.

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  


Here's the programm code: int magic(int a, int b) { return b == 0 ? a : magic(b, a % b); } int main() { int a, b; scanf("%d%d", &a, &b); printf("%d\n", magic(a, b)); return 0; } on input stream we have integers 4, 45 What's the output integer? How many times will be initiated "magic" function?

1 Answers  


what is virtual constroctor ? give an exam for it?-(parimal dhimmar)

2 Answers  


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

0 Answers  


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

0 Answers  


write a function -oriented program that generates the Fibonacci, the current numbers of n(as input) and display them (series). In Fibonacci, the current third number is the sum of the previous number.

3 Answers  


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

3 Answers   TCS, Vimukti Technologies, Wipro,


Categories