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
What is #error and use of it?
What is function prototype in c language?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
Why string is used in c?
What is the size of empty structure in c?
Describe dynamic data structure in c programming language?
Do you know the use of 'auto' keyword?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
What does == mean in texting?
Explain the difference between getch() and getche() in c?
How can a process change an environment variable in its caller?
How many types of operator or there in c?
write a progrmm in c language take user interface generate table using for loop?
What is "Duff's Device"?