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

How do you print an address?

1265


Explain why can’t constant values be used to define an array’s initial size?

1351


What are valid operations on pointers?

1195


What are structure members?

1090


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2119


What does c mean in basketball?

994


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

1238


Why is c known as a mother language?

1239


How can you draw circles in C?

1156


What is structure padding and packing in c?

1067


What are Macros? What are its advantages and disadvantages?

1159


What is the purpose of main( ) in c language?

1132


What is the best way of making my program efficient?

1029


What are reserved words with a programming language?

1132


Does c have function or method?

993