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
Write a code on reverse string and its complexity.
What is equivalent to ++i+++j?
Explain the priority queues?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
how logic is used
How will you find a duplicate number in a array without negating the nos ?
write a program to rearrange the array such way that all even elements should come first and next come odd
Which is better between malloc and calloc?
What is the difference between typedef struct and struct?
What is difference between structure and union?
What is the difference between NULL and NUL?
Why is %d used in c?
What is #line in c?
Does sprintf put null character?