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

What is exit() function?

1027


What is the difference between mpi and openmp?

1301


If I have a char * variable pointing to the name of a function ..

1176


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1948


Do you know the difference between exit() and _exit() function in c?

1062


What does do in c?

1060


How can I write functions that take a variable number of arguments?

1130


Why header file is used in c?

1097


Where is c used?

1096


Once I have used freopen, how can I get the original stdout (or stdin) back?

1077


What is a char c?

1043


What is call by reference in functions?

1457


What is %d used for?

1042


Why do we use null pointer?

1073


How to write c functions that modify head pointer of a linked list?

992