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
Can you please explain the difference between malloc() and calloc() function?
What are the ways to a null pointer can use in c programming language?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Explain threaded binary trees?
What would be an example of a structure analogous to structure c?
Why is c called a mid-level programming language?
What does the error message "DGROUP exceeds 64K" mean?
How can I find the modification date of a file?
Explain how can a program be made to print the name of a source file where an error occurs?
What will the preprocessor do for a program?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
There seem to be a few missing operators ..
Is boolean a datatype in c?
What is the difference between local variable and global variable in c?
What is the purpose of sprintf() function?