Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / rupamrox
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,prime;
clrscr();
for(i=2;i<20;i++)
{
prime=1;
for(j=2;j<i;j++)
{
if(i%j==0)
prime=0;
}
if(prime==1)
printf("%d",i);
}
getch();
}
| Is This Answer Correct ? | 9 Yes | 7 No |
Post New Answer View All Answers
How can I open a file so that other programs can update it at the same time?
Can math operations be performed on a void pointer?
How many parameters should a function have?
What are valid operations on pointers?
Do you know null pointer?
What is the use of header files?
What is clrscr in c?
What are reserved words?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What is extern storage class in c?
What are near, far and huge pointers?
Explain heap and queue.
If errno contains a nonzero number, is there an error?
How do you override a defined macro?