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 a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / prasad avunoori

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace primeNumber
{
class Program
{

static void Main(string[] args)
{
int s=0;
int c,k;
for (int i = 2; i < 100; i++)

{
c = 0;
for (int j = 1; j <= i; j++)

{
if(i%j==0)
{
c = c + 1;

}

}
if (c == 2)
{

Console.WriteLine(i);
s++;

}


} Console.WriteLine("There are " +s);
Console.ReadLine();
}
}
}

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2624


How do you list files in a directory?

1212


What is the difference between array and structure in c?

1245


cavium networks written test pattern ..

4141


Are local variables initialized to zero by default in c?

1100


Are c and c++ the same?

1104


What is wild pointer in c?

1127


What are the 4 data types?

1059


What is array of structure in c programming?

1333


How to find a missed value, if you want to store 100 values in a 99 sized array?

1463


Why is c known as a mother language?

1291


What are types of structure?

1172


What is dynamic memory allocation?

1390


Write a program to swap two numbers without using third variable?

1351


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

2141