Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / bheem rao
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,count=0;
for(i=2;i<=20;i++)
{
for(j=1;j<=i;i++)
{
if(i%j==0)
count++;
}
if(count==2)
printf("%d\n",i);
count=0;
}
}
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
Which is better between malloc and calloc?
How do you construct an increment statement or decrement statement in C?
What is the advantage of c?
Explain the difference between malloc() and calloc() in c?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
Is null equal to 0 in sql?
What are lookup tables in c?
Why is this loop always executing once?
What is the difference between array and linked list in c?
What is the difference between union and structure in c?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
What is difference between structure and union?
Subtract Two Number Without Using Subtraction Operator
What does *p++ do? What does it point to?
What are the different data types in C?