write the program for prime numbers?
Answer Posted / farhana parvin sunny
#include<stdio.h>
int main()
{
int i,j,n,f=0;
printf("Enter the length\n");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<i;j++)
{
if((i%j)==0)
{
f=1;
break;
}
f=0;
}
if(f==0)
printf("%d ",i);
}
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What are predefined functions in c?
What is the benefit of using an enum rather than a #define constant?
What is f'n in math?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
Do you know what are the properties of union in c?
Explain output of printf("Hello World"-'A'+'B'); ?
Why do we use static in c?
What is #line used for?
What is stack in c?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Explain what will the preprocessor do for a program?
How can I use a preprocessorif expression to ?
What are different types of operators?
write a program to rearrange the array such way that all even elements should come first and next come odd
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.