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...

How can i write a code in c# to take a number from the user
and then find all the prime numbers till the number entered
by the user.

Answer Posted / kumar gaurav

void main()
{
int num=0, i=0;
printf("Enter the number to ckeck");
scanf("%d",&num);
for (i=2;i<num;i++)
{
if (num%i==0)
{
printf("Number is not prime");
break;
}
}
if (i==num)
{
printf("Number is prime");
}
getch();
}

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is destructor in oop?

1038


Why multiple inheritance is not possible?

1078


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1863


What is the full form of oops?

1194


What do you mean by Encapsulation?

1096


what is graphics

2470


What is advantage of inheritance?

1177


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2623


What is encapsulation in ict?

1065


What is new keyword in oops?

1045


What is encapsulation process?

1056


What is use of overloading?

1150


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

2199


What is coupling in oop?

1040


is there any choice in opting subjects like 4 out of 7

2195