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 the program for prime numbers?

Answer Posted / ankish jaiswal

#include<stdio.h>
#include<conio.h>
int main()
{
int r,a,b,c=0;
printf("Enter the n value:");
scanf("%d",&r);
a=0;
while(a<=r)
{
b=1;c=0;
while(b<=a)
{
if(a%b==0)
c=c+1;
b++;
}
if(c==2)
printf("%d ",a);
a++;
}
getch();
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use null pointer?

1073


What is a stream water?

1225


What is the concatenation operator?

1156


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1250


Explain the properties of union. What is the size of a union variable

1190


Explain a pre-processor and its advantages.

1140


why do some people write if(0 == x) instead of if(x == 0)?

1083


Why C language is a procedural language?

1042


If errno contains a nonzero number, is there an error?

1379


What is operator promotion?

1078


Write a program with dynamically allocation of variable.

1140


What is pragma in c?

1219


Why c language is called c?

1021


What is the use of structure padding in c?

1078


What is adt in c programming?

1168