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 the prime numbers from 1 to 100?

Answer Posted / nikith

#include<stdio.h>
#include<conio.h>
int main()
{
int num,n,div,p;
printf("Enter any number: ");
scanf("%d", &num);
for(n=2; n<=num; n++)
{
for(div=2; div<n; div++)
{
if(n%div==0)
{
p=0;
break;
}
p=1;
}
if(p)
printf("\t%d",n);
}
getch();
return 0;
}

Is This Answer Correct ?    8 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is main an identifier in c?

1144


What is difference between union All statement and Union?

1111


What are the types of unary operators?

1188


What is the best way to store flag values in a program?

1076


Write programs for String Reversal & Palindrome check

1061


State the difference between x3 and x[3].

1112


What library is sizeof in c?

1092


What is static memory allocation? Explain

1097


What are header files and what are its uses in C programming?

1236


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2580


How many keywords are there in c?

1078


Why use int main instead of void main?

1120


What is exit() function?

1017


Explain what is meant by 'bit masking'?

1195


What is meant by operator precedence?

1145