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
What is the difference between if else and switchstatement
Explain what is wrong with this program statement?
What are the disadvantages of c language?
What is the use of typedef in structure in c?
Is c is a procedural language?
What does 1f stand for?
What is the best organizational structure?
Explain what are the standard predefined macros?
How many keywords (reserve words) are in c?
What is hashing in c?
develop algorithms to add polynomials (i) in one variable
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
I heard that you have to include stdio.h before calling printf. Why?
What is getch c?
What are the applications of c language?