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
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What is the use of extern in c?
What are formal parameters?
What is time null in c?
What is NULL pointer?
Explain how can you be sure that a program follows the ansi c standard?
When should you use a type cast?
What is difference between far and near pointers?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What is difference between union and structure in c?
What is getch?
How do you define structure?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Explain what is the use of a semicolon (;) at the end of every program statement?
What is the use of function overloading in C?