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...

write a program to search for an element in a given array.
If the array was found then display its position otherwise
display appropriate message in c language

Answer Posted / kapil hansrajani

include<stdio.h>
#include<conio.h>
void main()
{
int a[100],i,j,n;
clrscr();
printf("Enter the number of elements : ");
scanf("%d",&n);
printf("Enter the elements: ");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter the element to search : ");
scanf("%d",&j);
for(i=0;i<n;i++)
{
if(a[i]==j)
{
printf("The position of the element %d is %d ",j,i);
break;
}
}
getch();
}

Is This Answer Correct ?    48 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1691


What is || operator and how does it function in a program?

1082


Explain what is gets() function?

1069


Is there a built-in function in C that can be used for sorting data?

1250


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1293


Explain what’s a signal? Explain what do I use signals for?

1148


how to find anagram without using string functions using only loops in c programming

3187


What is gets() function?

1120


Why pointers are used in c?

1006


please explain every phase in the "SDLC" in the dotnet.

2612


What is int main () in c?

1083


Can you explain the four storage classes in C?

1119


What are the 5 organizational structures?

1023


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

2056


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15805