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
Why n++ execute faster than n+1 ?
Explain how do you list a file’s date and time?
Write a program to generate the Fibinocci Series
Explain what is wrong with this program statement? Void = 10;
How can you call a function, given its name as a string?
Why does everyone say not to use gets?
Why is c still so popular?
Give basis knowledge of web designing ...
provide an example of the Group by clause, when would you use this clause
How can I prevent another program from modifying part of a file that I am modifying?
What is the heap in c?
What are valid operations on pointers?
What is difference between class and structure?
What is the difference between printf and scanf )?
What is the use of a semicolon (;) at the end of every program statement?