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
Is c compiled or interpreted?
write a program to create a sparse matrix using dynamic memory allocation.
Can you please explain the difference between syntax vs logical error?
Explain what is the difference between text files and binary files?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What is a scope resolution operator in c?
What is I ++ in c programming?
Explain how to reverse singly link list.
What is the usage of the pointer in c?
What is difference between union All statement and Union?
Where local variables are stored in c?
What is meant by preprocessor in c?
How can I access an I o board directly?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
Can I initialize unions?