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 exit() and _exit() function in c?

1038


How do you define CONSTANT in C?

1220


What is a function simple definition?

1048


What is the difference between single charater constant and string constant?

1049


Explain the advantages and disadvantages of macros.

1046


What extern c means?

943


What does d mean?

1030


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

972


How are pointers declared in c?

1019


What is volatile variable how do you declare it?

1047


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1661


What is the difference between #include

and #include “header file”?

982


Is swift based on c?

1062


Write programs for String Reversal & Palindrome check

1022


How can I avoid the abort, retry, fail messages?

1103