write the program for prime numbers?
Answer Posted / karthikeyan murugesan
hi u can try this one for prime number and generation ::
#include<stdio.h>
void main()
{
int n,i=1,j,c;
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
{
printf("%d",i);
i++;
}
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Tell me when is a void pointer used?
What is malloc calloc and realloc in c?
Explain how can you avoid including a header more than once?
Why we write conio h in c?
What is wrong with this statement? Myname = 'robin';
What's a good way to check for "close enough" floating-point equality?
Is it better to bitshift a value than to multiply by 2?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
What is union and structure?
What is a 'null pointer assignment' error?
Explain what are binary trees?
i want to know the procedure of qualcomm for getting a job through offcampus
What is a program flowchart and explain how does it help in writing a program?
What is huge pointer in c?
How do you redirect a standard stream?