Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / sreejesh1987
//Ha Ha I'm the creator of shortest code
//for prime numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
printf("\t\t\tPRIME NUMBERS 1-20\n");
printf("\n\t2");
for(i=3;i<=20;i++)
for(j=2;j<i,i%j!=0;j++)
if(i-1==j)
printf("\n\t%d",i);
getch();
}
| Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
What are the types of variables in c?
Is there sort function in c?
What is const and volatile in c?
What does the && operator do in a program code?
How can you access memory located at a certain address?
What standard functions are available to manipulate strings?
What is nested structure in c?
What happens if you free a pointer twice?
What is a program?
How can I open files mentioned on the command line, and parse option flags?
Is c still used?
Once I have used freopen, how can I get the original stdout (or stdin) back?
Explain what is page thrashing?
What is the purpose of sprintf() function?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?