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
Explain how can you tell whether a program was compiled using c versus c++?
What is bss in c?
Why doesnt the call scanf work?
Can you subtract pointers from each other? Why would you?
What is const keyword in c?
What is getch () for?
What is a scope resolution operator in c?
How can I access an I o board directly?
In C, What is the #line used for?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
write a c program for swapping two strings using pointer
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Explain what is a stream?
Explain union.
write a c program in such a way that if we enter the today date the output should be next day's date.