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 |
Are c and c++ the same?
program to find a smallest number in an array
Disadvantages of C language.
What is pointer in c?
Explain what is the purpose of "extern" keyword in a function declaration?
What is an object?
How do you redirect a standard stream?
What are local and global variables?
Can we compile a program without main() function?
how to print this pyramid * * * * * * * * * * * * *
how to find the kth smallest element in the given list of array elemnts.
Why should I prototype a function?