Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

How can I open a file so that other programs can update it at the same time?

1134


Can math operations be performed on a void pointer?

973


How many parameters should a function have?

1130


What are valid operations on pointers?

1153


Do you know null pointer?

978


What is the use of header files?

1060


What is clrscr in c?

1078


What are reserved words?

1047


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2705


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1230


What is extern storage class in c?

946


What are near, far and huge pointers?

1015


Explain heap and queue.

1014


If errno contains a nonzero number, is there an error?

1296


How do you override a defined macro?

1209