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

what is the significance of static storage class specifier?

2265


How do you determine a file’s attributes?

1089


What is the difference between a function and a method in c?

1087


What is the difference between int main and void main in c?

1182


What is a spanning Tree?

1597


Explain how can a program be made to print the name of a source file where an error occurs?

1197


Are c and c++ the same?

1058


Why dont c comments nest?

1052


What does != Mean in c?

1055


How can I call fortran?

1049


Explain what are preprocessor directives?

1070


Explain the difference between #include "..." And #include <...> In c?

1033


What is c preprocessor mean?

1319


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1074


How do you use a pointer to a function?

1090