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 size of enum in bytes?
What are the types of data types and explain?
What is a pointer value and address in c?
What are the similarities between c and c++?
Write a program to print fibonacci series without using recursion?
What are valid signatures for the Main function?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Implement bit Array in C.
What are the two types of functions in c?
Is it valid to address one element beyond the end of an array?
Why is it important to memset a variable, immediately after allocating memory to it ?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
How do I copy files?
Explain what is wrong in this statement?
Write a progarm to find the length of string using switch case?