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
Can we add pointers together?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
How are portions of a program disabled in demo versions?
How can I find the modification date and time of a file?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What are two dimensional arrays alternatively called as?
Why c is called top down?
What is a dynamic array in c?
Is that possible to store 32768 in an int data type variable?
Differentiate between full, complete & perfect binary trees.
Is c easier than java?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Differentiate between new and malloc(), delete and free() ?
What is pivot in c?
What are Macros? What are its advantages and disadvantages?