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 / vinay tiwari

try this u can find out all prime number between 2 and any
number entered by user .i write code in c# language but
concept remain same in any language.
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication23
{
class Program
{
static void Main(string[] args)
{
int i=2, j, rem;
while (i <= 100)
{
for (j = 2; j < i; j++)
{
rem = i % j;
if (rem == 0)
break;
}
if (i == j)
Console.WriteLine(i);
i++;
}
}
}
}

Is This Answer Correct ?    250 Yes 136 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are structure types in C?

1046


how should functions be apportioned among source files?

1053


How can a process change an environment variable in its caller?

1124


how do you programme Carrier Sense Multiple Access

1925


Explain what is the difference between functions getch() and getche()?

985


What is the code in while loop that returns the output of given code?

1889


What is ## preprocessor operator in c?

1023


There seem to be a few missing operators ..

1000


Is c procedural or functional?

975


Why header file is used in c?

1020


What is break in c?

984


What is the difference between local variable and global variable in c?

1159


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

1187


What is spaghetti programming?

1069


What are pointers? Why are they used?

1109