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 / ricky dobriyal

/* hello i am ricky dobriyal software enginear*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,s;
printf("prime number 1 to 20 :\n");
for(i=1;i<=20;i++)
{
s=0;
for(j=2;j<i;j++)
{
if(i==1)
s=0;
else if(i%j==0)
s=1;
}
if(s==0)
printf("%d\t",i);
}
getch();
}

output:-1 2 3 4 7 11 13 17 19

Is This Answer Correct ?    18 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to identify if a given binary tree is balanced or not.

1172


How was c created?

1072


What is #pragma statements?

1105


What is calloc()?

1080


What is adt in c programming?

1172


What are register variables in c?

1018


Ow can I insert or delete a line (or record) in the middle of a file?

1006


Explain what are binary trees?

1086


What are qualifiers in c?

1042


What’s a signal? Explain what do I use signals for?

1117


How can I implement sets or arrays of bits?

1049


explain how do you use macro?

1166


What is the default value of local and global variables in c?

1050


How can I swap two values without using a temporary?

1114


What is wrong in this statement?

1157