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 is a constant?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Is c is a middle level language?
What are the __date__ and __time__ preprocessor commands?
What is variables in c?
When would you use a pointer to a function?
what is the syallabus of computer science students in group- 1?
What is a structure member in c?
What is character constants?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
What is the scope of global variable in c?
What is a 'null pointer assignment' error?
Is that possible to store 32768 in an int data type variable?
Describe the modifier in c?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?