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 array within structure?
What is the difference between malloc() and calloc() function in c language?
Write a program to reverse a given number in c?
Which is better malloc or calloc?
What is the difference between volatile and const volatile?
How can you check to see whether a symbol is defined?
Are pointers integers in c?
What is auto keyword in c?
When was c language developed?
What are pointers? What are stacks and queues?
Explain how do I determine whether a character is numeric, alphabetic, and so on?
What are the standard predefined macros?
Why do we use pointer to pointer in c?
Difference between Function to pointer and pointer to function
What is indirection in c?