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
With the help of using classes, write a program to add two numbers.
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
can we implement multi-threads in c.
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is a null string in c?
What does the file stdio.h contain?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is the difference between variable declaration and variable definition in c?
How can variables be characterized?
Explain what is the benefit of using enum to declare a constant?
What is function pointer c?
What is the difference between fread buffer() and fwrite buffer()?
What is the basic structure of c?
What is a stream water?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.