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

wite a programme in c to linear search a data using flag and
without using flags?

Answer Posted / ruchi

#include<stdio.h>
#include<conio.h>
int main()
{
int n,i,a[15],num;
printf("\nHow many elements are there ");
scanf("%d",&n);
printf("\nEnter the elements ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nEnter the element do you want to search ");
scanf("%d",&num);
for(i=0;i<n;i++)
{
if(a[i]==num)
{
printf("\nElement is present ");
break;
}
else if((a[i]!=num)&&(i==n-1
))
{
printf("\nElement is not present");
}
}
getch();
}

Is This Answer Correct ?    19 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is substring in c?

1183


How can I recover the file name given an open stream?

999


What is 1f in c?

2631


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3292


Calculate 1*2*3*____*n using recursive function??

2020


What is %d used for?

1024


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

1451


What are the ways to a null pointer can use in c programming language?

1119


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2798


What is array in C

1141


write a program to find the given number is prime or not

4729


how many key words availabel in c a) 28 b) 31 c) 32

1060


FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.

1734


Why dont c comments nest?

1034


What is switch in c?

1070