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
What do you mean by a local block?
What is void main () in c?
What is static identifier?
Ow can I insert or delete a line (or record) in the middle of a file?
What is a example of a variable?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
How can I automatically locate a programs configuration files in the same directory as the executable?
Why c is called free form language?
What are the key features in c programming language?
What is enumerated data type in c?
Does sprintf put null character?
What is spaghetti programming?
What is the stack in c?
What is an operator?
What is the purpose of sprintf() function?