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
If fflush wont work, what can I use to flush input?
Write a program to generate the Fibinocci Series
Can you please explain the difference between syntax vs logical error?
what do u mean by Direct access files? then can u explain about Direct Access Files?
write a progrmm in c language take user interface generate table using for loop?
Explain the advantages of using macro in c language?
Is there anything like an ifdef for typedefs?
c language interview questions & answer
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Explain the concept and use of type void.
how is the examination pattern?
What is c token?
What is the heap in c?
What is the default value of local and global variables in c?
What tq means in chat?