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
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 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,
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; }
write a program to calculate the radius for a quadratic equation use modular programming(function abitraction)hint use quadratic function
1 Answers ICAN, Jomo Kenyatta University,
how to write a program that opens a file and display in reverse order?
1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.
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.
output for printf("printf");
PROBLEM #8 The cashier at the counter of a Super Store, Mr. Khazaanchi has the following bundles of rupee cash notes with him: Rs. 1, 2, 5, 10, 50, 100, 500, 1000 A customer comes at his counter with various items that he has shopped. Mr. Khazaanchi totals the item prices and tells the customer his total amount payable. The customer gives Mr. Khazanchi some amount of cash. Find the total number of rupee notes of each denomination (i.e. 1, 2, 5, 10, 50, 100, 500, 1000) Mr. Khazaanchi will have to give to the withdrawer ensuring that the total number of rupee notes are minimum.
develop a program to calculate and print body mass index for 200 employees
0 Answers Jomo Kenyatta University,
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file
write a program using virtual function to find the transposing of a square matrix?
write a program that can LOCATE and INSERT elements in array using c++ programming languages.