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


Please Help Members By Posting Answers For Below Questions

What is a null pointer in c?

828


Write a program to reverse a linked list in c.

854


Why doesn't C support function overloading?

2159


What are the different types of pointers used in c language?

785


How the c program is executed?

861


What are the data types present in c?

839


What is the use of printf() and scanf() functions?

817


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

885


Is main an identifier in c?

837


What is the difference between #include

and #include “header file”?

773


Why main is not a keyword in c?

895


How are portions of a program disabled in demo versions?

1003


What is LINKED LIST? How can you access the last element in a linked list?

827


Is it valid to address one element beyond the end of an array?

916


Why is C language being considered a middle level language?

843