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

Write programs for String Reversal & Palindrome check

1026


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5908


Explain how do you generate random numbers in c?

1059


What does the message "automatic aggregate intialization is an ansi feature" mean?

1153


What is sorting in c plus plus?

946


What is memcpy() function?

1066


please give me some tips for the placement in the TCS.

2074


Explain logical errors? Compare with syntax errors.

1030


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1101


What are the types of data files?

1164


What are static variables in c?

1038


program for reversing a selected line word by word when multiple lines are given without using strrev

2440


How are Structure passing and returning implemented by the complier?

1132


What is meant by operator precedence?

1104


Explain data types & how many data types supported by c?

1035