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!

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)

4453


Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7344


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3193


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2565


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

2010






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.

1970


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

2845


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

3397


Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.

4398


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

1820


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

2407


1+1/2!+1/3!+...+1/n!

1945


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

3274


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

4355


Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

3398