Write a program to print the prime numbers from 1 to 100?
Answer Posted / prth
#include<stdio.h>
#include<conio.h>
void main()
{
int flag,x;
clrscr();
printf("1\t");
for(int i=1;i<=100;i++)
{
flag=0;
for(x=2;x<=i;x++)
{
if(i%x==0)
{
flag=1;
break;
}
else
continue;
}
if(i==x)
printf("%d\t",i);
}
getch();
}
Is This Answer Correct ? | 48 Yes | 11 No |
Post New Answer View All Answers
Do character constants represent numerical values?
What is the difference between array_name and &array_name?
What is stack in c?
What is the purpose of macro in C language?
What is the difference between exit() and _exit() function?
How to throw some light on the b tree?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
explain what are pointers?
a program that can input number of records and can view it again the record
Why static variable is used in c?
What is the difference between strcpy() and memcpy() function in c programming?
Do you have any idea about the use of "auto" keyword?
What header files do I need in order to define the standard library functions I use?
Is int a keyword in c?
Why we not create function inside function.