write the program for prime numbers?
Answer Posted / sreejesh1987
//Output primes upto limit n(Give n>2)
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("\t\t\tPRIME NUMBERS\n");
printf("Enter n:");
scanf("%d",&n);
printf("\n\t2");
for(i=3;i<=n;i++)
for(j=2;j<i,i%j!=0;j++)
if(i-1==j)
printf("\n\t%d",i);
getch();
}
| Is This Answer Correct ? | 11 Yes | 13 No |
Post New Answer View All Answers
What are the 4 data types?
How many levels of pointers have?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Explain how do you override a defined macro?
Why do we use static in c?
What are dangling pointers in c?
What are pointers? What are stacks and queues?
Can stdout be forced to print somewhere other than the screen?
What is function what are the types of function?
What is meant by int main ()?
What is the difference between functions abs() and fabs()?
Can I initialize unions?
What is the purpose of ftell?
Why is c not oop?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above