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

Is there any demerits of using pointer?

1066


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1132


What is difference between Structure and Unions?

1249


What is the difference between printf and scanf in c?

1349


Is the exit() function same as the return statement? Explain.

1090


What does a function declared as pascal do differently?

1119


What is double pointer?

993


what is the height of tree if leaf node is at level 3. please explain

2147


What is external variable in c?

1054


What is the advantage of an array over individual variables?

1226


How do we make a global variable accessible across files? Explain the extern keyword?

1876


Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.

4202


What is p in text message?

976


Why is c so powerful?

1111


How do you redirect a standard stream?

1100