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 difference between malloc() and calloc() function in c language?

1081


What does %2f mean in c?

1222


What is atoi and atof in c?

1087


Explain what standard functions are available to manipulate strings?

1076


What is wrong with this declaration?

1106


What is advantage of pointer in c?

1184


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

1083


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1126


What is meant by 'bit masking'?

1390


Which programming language is best for getting job 2020?

1050


Can we initialize extern variable in c?

1136


how to write optimum code to divide a 50 digit number with a 25 digit number??

3268


What is const keyword in c?

1163


Why can’t constant values be used to define an array’s initial size?

1378


What are the features of c languages?

1101