Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Design a program using an array that searches a number if it
is found on the list of the given input numbers and locate
its exact location in the list.

Answer Posted / dartz

#include<stdio.h>
#include<conio.h>
void main()
{
int ch[100],m,n,flag=0;
printf("enter the limit value");
scanf("%d",&m);
for(int i=0;i<m;i++)
scanf("%d",&a[i]);
printf("enter the number u are searching for :");
scanf("%d",&n);
for(i=0;i<m;i++)
{
if(a[i]==n)
{
printf("%d number is found at the position %d in the
given array ",n,i);
i=m;// to come out from the loop when we found
searching number
flag=1;

}
}


if( flag = 0)
{
printf(" given number is not found in the list of array");

}




getch();
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #include conio h?

970


What does typedef struct mean?

1064


When should the volatile modifier be used?

1126


What are the features of c language?

1034


List the difference between a "copy constructor" and a "assignment operator"?

972


What is the difference between volatile and const volatile?

951


What is a 'null pointer assignment' error?

1183


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

1039


What is c basic?

1144


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1904


When should a type cast be used?

980


how to capitalise first letter of each word in a given string?

1889


What is extern c used for?

1019


What does the format %10.2 mean when included in a printf statement?

1609


I came across some code that puts a (void) cast before each call to printf. Why?

1172