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 is the value of uninitialized variable in c?
What are conditional operators in C?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Write a program to generate random numbers in c?
What is array within structure?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What do you know about the use of bit field?
What is the most efficient way to count the number of bits which are set in an integer?
What is signed and unsigned?
Explain how do you convert strings to numbers in c?
Is c# a good language?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
How can my program discover the complete pathname to the executable from which it was invoked?
how could explain about job profile