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

What is the use of a semicolon (;) at the end of every program statement?

1588


Explain how can you determine the size of an allocated portion of memory?

1151


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1172


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2748


Write a program to show the change in position of a cursor using c

1123


What is header file in c?

1108


What is the difference between NULL and NUL?

1352


Why c is called a middle level language?

1162


What is chain pointer in c?

1115


Explain indirection?

1184


What is void c?

1164


Explain about the functions strcat() and strcmp()?

1095


Explain logical errors? Compare with syntax errors.

1128


Can variables be declared anywhere in c?

1149


How can I find the modification date and time of a file?

1126