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 / vs

#include<stdio.h>
#include<conio.h>
void main()
int a[5],i;
int e,t=0,p=0;
clrscr();
printf("enter the array of elements/n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
clrscr();
printf("enter the element to search/n");
scanf("%d",&e);
for(i=0;i<5;i++)
{
if(a[i]==e)
{
t=1;
p=i;
}
}
if(t==1)
printf("element found--%d/n position--%d",e,p);
else
printf("element not found/n");
getch();
}

Is This Answer Correct ?    21 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which is an algorithm for sorting in a growing Lexicographic order

1744


What is C language ?

1901


Explain what is the difference between #include and #include 'file' ?

967


What is the difference between null pointer and wild pointer?

1135


What is a union?

979


What is a macro in c preprocessor?

1050


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2687


How do you view the path?

1074


What are global variables and explain how do you declare them?

1029


How can I discover how many arguments a function was actually called with?

1018


Is c easy to learn?

932


How can I read a binary data file properly?

1070


What is the difference between far and near ?

1155


Is c object oriented?

908


What is hash table in c?

969