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 is the use of ?

1044


How do you define a string?

1109


How can I sort a linked list?

1052


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

1508


i want to know the procedure of qualcomm for getting a job through offcampus

2476


How #define works?

1115


What does the function toupper() do?

1138


Explain how can I prevent another program from modifying part of a file that I am modifying?

1099


What is s or c?

1069


Are pointers integer?

1023


Is c++ based on c?

1081


Write a program to check palindrome number in c programming?

1025


Are comments included during the compilation stage and placed in the EXE file as well?

1088


Function calling procedures? and their differences? Why should one go for Call by Reference?

1092


What is difference between constant pointer and constant variable?

1324