Write a program to print the prime numbers from 1 to 100?
Answer Posted / aravind
#include<stdio.h?
int main()
{
int i,count=0;
for(i=1;i<=100;i++)
{
a=i%10;
if(a==0)
{
count++;
if(count<=2)
printf("the prime numbers are %d",i);
}
else
count=count;
}
the above answer is good but it will not print 1 as prime.
| Is This Answer Correct ? | 14 Yes | 23 No |
Post New Answer View All Answers
What is the easiest sorting method to use?
How can you determine the size of an allocated portion of memory?
How can I get the current date or time of day in a c program?
How can I sort a linked list?
What is sizeof array?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Can a variable be both static and volatile in c?
Explain which function in c can be used to append a string to another string?
why return type of main is not necessary in linux
Why use int main instead of void main?
What is nested structure?
What is difference between array and pointer in c?
What is the -> in c?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
Who is the founder of c language?