Write a program to print prime nums from 1-20 using c
programing?

Answer Posted / rupamrox

#include<stdio.h>
#include<conio.h>
main()
{
int i,j,prime;
clrscr();
for(i=2;i<20;i++)
{
prime=1;
for(j=2;j<i;j++)
{
if(i%j==0)
prime=0;
}
if(prime==1)
printf("%d",i);
}
getch();
}

Is This Answer Correct ?    9 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the ANSI C Standard?

771


Is a house a mass structure?

635


What is c definition?

735


what is bit rate & baud rate? plz give wave forms

1509


What is strcmp in c?

592






What is scope rule in c?

598


Why isn't any of this standardized in c? Any real program has to do some of these things.

619


Where local variables are stored in c?

552


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

653


Write a program to print all permutations of a given string.

636


How can I discover how many arguments a function was actually called with?

628


What is difference between array and structure in c?

571


What is null pointer constant?

589


What are reserved words?

647


What are high level languages like C and FORTRAN also known as?

678