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
How can I get back to the interactive keyboard if stdin is redirected?
In C programming, what command or code can be used to determine if a number of odd or even?
What are different storage class specifiers in c?
What is far pointer in c?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
What are register variables in c?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What are the main characteristics of c language describe the structure of ac program?
Why is c so popular?
Explain how can I make sure that my program is the only one accessing a file?
What are the applications of c language?
What is a global variable in c?
What is volatile variable in c?
What is modeling?
Explain what is gets() function?