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 / tirth raj

#include<stdio.h>
#include<conio.h>
void main()
{
int num,div;
clrscr();
printf("First two prime no.1&2");
for(num=3;num<=100;num++)
{
div=2;
while(div<=num-1)
{
if(num%div==0)
{
break;
}
else
{
div++;
}
}
if(div==num)

printf("\nPrime Number = %d",num);
}
getch();
}

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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


Tell me what are bitwise shift operators?

1094


any "C" function by default returns an a) int value b) float value c) char value d) a & b

1044


How can I read data from data files with particular formats?

1006


What is the difference between array and pointer?

969


what is the role you expect in software industry?

2085


Why static variable is used in c?

984


When we use void main and int main?

1020


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

5158


What is gets() function?

1077


What is difference between stdio h and conio h?

1327


Why header files are used?

1067


Hi can anyone tell what is a start up code?

2003


What is pointer & why it is used?

1063


Are pointers integer?

961