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
Can you write the function prototype, definition and mention the other requirements.
What is volatile variable in c with example?
Explain the difference between the local variable and global variable in c?
Explain the difference between malloc() and calloc() function?
Explain how can you be sure that a program follows the ansi c standard?
What is a program?
What header files do I need in order to define the standard library functions I use?
What does printf does?
What is an endless loop?
Explain how to reverse singly link list.
Differentiate between the = symbol and == symbol?
Is there any data type in c with variable size?
Which driver is a pure java driver
Write a program to print factorial of given number without using recursion?
How to delete a node from linked list w/o using collectons?