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 difference between int main and void main in c?
What are predefined functions in c?
When c language was developed?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
How can I implement sets or arrays of bits?
Explain the process of converting a Tree into a Binary Tree.
Is c high or low level?
What is int main () in c?
What is a union?
What are the different types of linkage exist in c?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
Why structure is used in c?
What are the types of variables in c?
What is #include stdlib h?
Why do we use stdio h and conio h?