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
write a program to rearrange the array such way that all even elements should come first and next come odd
What does malloc () calloc () realloc () free () do?
what is different between auto and local static? why should we use local static?
Did c have any year 2000 problems?
How can I automatically locate a programs configuration files in the same directory as the executable?
How can this be legal c?
how to capitalise first letter of each word in a given string?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
What are the standard predefined macros?
What is wrong in this statement? scanf(ā%dā,whatnumber);
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
Write a program to swap two numbers without using third variable in c?
Explain how does flowchart help in writing a program?
How is a structure member accessed?
What is operator promotion?