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 |
IS Doon college of Engn.. has good faculty
How can I call fortran?
Explain void pointer?
write a program to generate 1st n fibonacci prime number
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
How does selection sort work in c?
What is malloc and calloc?
What is putchar() function?
write a function to swap an array a[5] elements like a[0] as a[5],a[1] as a[4],....a[5] as a[0].without using more than one loop and use one array not to use temp array?
Who invented bcpl language?
C program to read the integer and calculate sum and average using single dimensional array
Which function in C can be used to append a string to another string?