read an array and search an element
Answer / meera
#include<stdio.h>
#include<conio.h>
void main()
{
int a[50],i,j,n,key,count=0;
clrscr();
printf("Enter the no.of elements:");
scanf("%d",&n);
printf("Enter the numbers:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("enter the number to be searched:");
scanf("%d",&key);
for(i=0;i<n;i++)
{
if a[i]==key
(
count++;
printf("\nThe number %d is present",key);
}
}
printf("number of occurance is %d",count);
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
How can I remove the leading spaces from a string?
what will happen if you free a pointer twice after allocating memory dynamically ?
how can we use static and extern?and where can we use this?
i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k);
Can a function argument have default value?
what is the main use of c where it can use the c
c program to add and delete an element from circular queue using array
What is structure of c program?
What does 3 mean in texting?
main() { int i=5; printf("%d%d%d%d",i++,i--,i); }
What's the best way of making my program efficient?
Why header file is used in c?