Write a program to print the prime numbers from 1 to 100?
Answer Posted / tirth raj
#include<stdio.h>
#include<conio.h>
void main()
{
int num,div;
clrscr();
printf("First two prime no.1&2");
for(num=3;num<=100;num++)
{
div=2;
while(div<=num-1)
{
if(num%div==0)
{
break;
}
else
{
div++;
}
}
if(div==num)
printf("\nPrime Number = %d",num);
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 6 No |
Post New Answer View All Answers
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Tell me what are bitwise shift operators?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How can I read data from data files with particular formats?
What is the difference between array and pointer?
what is the role you expect in software industry?
Why static variable is used in c?
When we use void main and int main?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
What is gets() function?
What is difference between stdio h and conio h?
Why header files are used?
Hi can anyone tell what is a start up code?
What is pointer & why it is used?
Are pointers integer?