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
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What is the use of pointers in C?
what is the difference between class and unio?
What is c programming structure?
Why is c called a structured programming language?
What is the use of putchar function?
Explain how can you check to see whether a symbol is defined?
What is NULL pointer?
What is far pointer in c?
can any one tel me wt is the question pattern for NIC exam
How do you determine a file’s attributes?
What is data structure in c programming?
Describe the order of precedence with regards to operators in C.
regarding pointers concept