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


Please Help Members By Posting Answers For Below Questions

What is extern storage class in c?

509


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

627


what will be the output for the following main() { printf("hi" "hello"); }

9312


Can you please explain the scope of static variables?

597


What is the purpose of & in scanf?

589






What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

583


What is the difference between union and structure in c?

569


What is c token?

603


Is there anything like an ifdef for typedefs?

696


What is #line?

607


What is sizeof int?

629


What are the primitive data types in c?

570


which is conditional construct a) if statement b) switch statement c) while/for d) goto

736


What is the advantage of c?

607


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1924