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

Can math operations be performed on a void pointer?

1007


Explain what are the different data types in c?

1183


What is the process to generate random numbers in c programming language?

1120


What is the difference between int main and void main?

1012


Give me the code of in-order recursive and non-recursive.

1335


What is the maximum no. of arguments that can be given in a command line in C.?

1102


What is use of integral promotions in c?

1094


What are the different types of control structures?

998


The statement, int(*x[]) () what does in indicate?

1101


What is echo in c programming?

979


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

2115


Describe the order of precedence with regards to operators in C.

1012


How many header files are in c?

1003


Explain About fork()?

1069


How will you divide two numbers in a MACRO?

1086