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
Write a program to identify if a given binary tree is balanced or not.
How can variables be characterized?
What is a good data structure to use for storing lines of text?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Explain argument and its types.
Is printf a keyword?
Explain About fork()?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
I have a varargs function which accepts a float parameter?
code for replace tabs with equivalent number of blanks
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
How can I recover the file name given an open stream?
#include
Where static variables are stored in memory in c?
What is the easiest sorting method to use?