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 |
When we use void main and int main?
Explain function pointer with exapmles.
Why cant I open a file by its explicit path?
How do I determine whether a character is numeric, alphabetic, and so on?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
What are the salient features of c languages?
how to set Nth bit of variable by using MACRO
WAP to find that given no is small or capital
What do you mean by dynamic memory allocation in c? What functions are used?
why integer range between -327680to+32767
What are 'near' and 'far' pointers?
Multiply an Integer Number by 2 Without Using Multiplication Operator