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

Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

1100


What are runtime error?

1128


What are external variables in c?

1103


Is it better to bitshift a value than to multiply by 2?

1092


How can I ensure that integer arithmetic doesnt overflow?

1161


Explain how can type-insensitive macros be created?

992


What is the difference between printf and scanf )?

1096


Describe explain how arrays can be passed to a user defined function

1099


Explain what is the concatenation operator?

1168


Write a program to print ASCII code for a given digit.

1091


What is quick sort in c?

1086


What is getch () for?

1233


How many types of arrays are there in c?

1045


How can you avoid including a header more than once?

983


When can you use a pointer with a function?

1066