write the program for prime numbers?
Answer Posted / paps
#include<stdio.h>
void main()
{
int a=1,i,j,b,n;
printf("enter the range\n");
scanf("%d",&n);
printf("prime number series between 1 to %d:n");
printf("%d",a);
while(i<=n)
{
for(j=2;j<i;j++)
{
b=i%j;
if(b==0)
break;
}
if(i==j)
printf("%d",i);
i++;
}
getch();
}
Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
Should I learn data structures in c or python?
How can I handle floating-point exceptions gracefully?
Why is event driven programming or procedural programming, better within specific scenario?
What 'lex' does?
Is fortran still used today?
What does it mean when a pointer is used in an if statement?
What is wrong with this statement? Myname = 'robin';
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
When a c file is executed there are many files that are automatically opened what are they files?
How can I generate floating-point random numbers?
What is the difference between near, far and huge pointers?
Explain the use of function toupper() with and example code?
Why malloc is faster than calloc?
What is scope of variable in c?
Are pointers integers in c?