write the program for prime numbers?
Answer Posted / mudassir shakil
using System;
class Prime_Checker
{
int i;
int counter=0;
int n;
Console.WriteLine("Enter the number");
n=int.Parse(Console.ReadLine());
for(i=2;i<=n;i++)
{
if(n%i==0)
{
counter=1;
}
if(counter=0)
{
Console.WriteLine("No is prime");
}
else
{
Console.WriteLine("No is not prime");
}
}
}
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
Do you know the purpose of 'register' keyword?
Why array is used in c?
In c programming language, how many parameters can be passed to a function ?
What are c header files?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
Explain what does the function toupper() do?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
How do you list files in a directory?
What is the heap in c?
How can you access memory located at a certain address?
What are keywords c?
What is the difference between a string and an array?
How do you print only part of a string?
Where are some collections of useful code fragments and examples?
How do I get an accurate error status return from system on ms-dos?