Answer Posted / 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 |
Post New Answer View All Answers
Is c call by value?
Explain continue keyword in c
How would you obtain the current time and difference between two times?
Do you know what are bitwise shift operators in c programming?
Differentiate between functions getch() and getche().
What is difference between main and void main?
What is the difference between %d and %i?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What is auto keyword in c?
Explain is it valid to address one element beyond the end of an array?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is the best way of making my program efficient?
Explain what is the most efficient way to store flag values?
Difference between macros and inline functions? Can a function be forced as inline?
What is difference between far and near pointers?