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
What are shell structures used for?
difference between object file and executable file
What is the use of getchar functions?
How can a process change an environment variable in its caller?
Explain the advantages of using macro in c language?
Differentiate between new and malloc(), delete and free() ?
Why isnt any of this standardized in c?
Differentiate call by value and call by reference?
Explain what is the difference between #include and #include 'file' ?
What are the string functions? List some string functions available in c.
Are pointers integers in c?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
Explain continue keyword in c
What functions are in conio h?
Why do we need a structure?