write the program for prime numbers?
Answer Posted / priyanka chauhan
// prime no series. //
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the no: ");
scanf("%d",&n);
printf("\n");
for(i=1;i<=n;i++)
{
for(j=2;j<=i-1;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("%d ",j);
}
getch();
}
| Is This Answer Correct ? | 173 Yes | 84 No |
Post New Answer View All Answers
Why is a semicolon (;) put at the end of every program statement?
What is difference between structure and union?
What are header files why are they important?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
What are nested functions in c?
Why use int main instead of void main?
What is %s and %d in c?
What is wild pointer in c?
Is it better to bitshift a value than to multiply by 2?
What is nested structure?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
What are the types of data files?
Difference between constant pointer and pointer to a constant.
What is break statement?
explain how do you use macro?