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 the purpose of main( ) in c language?

649


Does c have enums?

614


What is an array? What the different types of arrays in c?

670


What language is windows 1.0 written?

597


What is the meaning of && in c?

560






What is the use of f in c?

572


What are register variables? What are the advantage of using register variables?

705


How can I find out the size of a file, prior to reading it in?

642


Does sprintf put null character?

615


What functions are in conio h?

677


What is logical error?

616


Tell me the use of bit field in c language?

640


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

1917


Not all reserved words are written in lowercase. TRUE or FALSE?

743


What are local static variables?

635