write the program for prime numbers?
Answer Posted / ankish jaiswal
#include<stdio.h>
#include<conio.h>
int main()
{
int r,a,b,c=0;
printf("Enter the n value:");
scanf("%d",&r);
a=0;
while(a<=r)
{
b=1;c=0;
while(b<=a)
{
if(a%b==0)
c=c+1;
b++;
}
if(c==2)
printf("%d ",a);
a++;
}
getch();
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which is better pointer or array?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
How does pointer work in c?
What is a floating point in c?
How do you determine a file’s attributes?
What does %p mean c?
write a program to find the given number is prime or not
What is c preprocessor mean?
why do some people write if(0 == x) instead of if(x == 0)?
Explain modulus operator.
Where is c used?
What is meant by initialization and how we initialize a variable?
What does c value mean?
How do you define structure?
Find MAXIMUM of three distinct integers using a single C statement