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 use of ?
How do you define a string?
How can I sort a linked list?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
i want to know the procedure of qualcomm for getting a job through offcampus
How #define works?
What does the function toupper() do?
Explain how can I prevent another program from modifying part of a file that I am modifying?
What is s or c?
Are pointers integer?
Is c++ based on c?
Write a program to check palindrome number in c programming?
Are comments included during the compilation stage and placed in the EXE file as well?
Function calling procedures? and their differences? Why should one go for Call by Reference?
What is difference between constant pointer and constant variable?