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
Why do we use null pointer?
What is a stream water?
What is the concatenation operator?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
Explain the properties of union. What is the size of a union variable
Explain a pre-processor and its advantages.
why do some people write if(0 == x) instead of if(x == 0)?
Why C language is a procedural language?
If errno contains a nonzero number, is there an error?
What is operator promotion?
Write a program with dynamically allocation of variable.
What is pragma in c?
Why c language is called c?
What is the use of structure padding in c?
What is adt in c programming?