a program using one dimensional array that searches a number
if it is found on the list of given input numbers given by
the user and locate its exact location in the list..
""EXAMPLE""
enter how many numbers to be inputted: 5
12 14 11 09 30
what number to search: 11
11 IS FOUND IN LOCATION 3

PLZZZ.. ELP ME...

Answer Posted / fabiha nazmi

#include <stdio.h>
int main()
{
int num[10], a,d, s, i;
printf("Enter how many numbers to be inputted: ");
scanf("%d", &d);

for (i=0; i<d; i++)
{
scanf("%d", &num[i]);
}
printf("what number to search: ");
scanf("%d", &s);
for(i=0; i<d; i++)
{
if (s==num[i])
{
printf("%d is found in location %d", s, i+1);
break;
}
}
return 0;
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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!!!)

3252


how to diplay a external image of output on winxp by using c & c++,

2924


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

3181


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

2177


write a program to convert temperature from fa height into celcius and vise versa,use modular programming

2424






Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

2901


Code for Easily Using Hash Table?

2377


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

2823


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.

3381


write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20

3350


Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

539


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

2656


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

2205


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

2384


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

1992