Gadget blog, Android KitKat, stock firmware, Unboxing, Toggle Mod Major Crashing Bug Fixed, Android Jelly Bean, Studio Mobile, Apk + DATA, How To Set, Unlocker Photo In WhatsApp, Majestic Tab Firmware Flash File

C# Program to check number is prime or composite

C# Program to check number is prime or composite - welcome to the blog Gadget Blog we provide information about the latest gadgets, which we provide for you for a while, now we discuss about C# Program to check number is prime or composite we have collected a lot of information about this article from many reliable sources, so please see:

Articles : C# Program to check number is prime or composite
full Link : C# Program to check number is prime or composite
Article Csharp, Article programming, Article programs,

You can also see our article on:


C# Program to check number is prime or composite

C# Program to check entered number is prime or composite 

Program Statement:
Write a program that takes an integer as an input from user and prints if it is a prime or composite number.

Solution:
 static void Main(string[] args)
{
int num, i;
Console.WriteLine("Enter the number to check number is prime or composite");
num=Convert.ToInt32(Console.ReadLine());
i = 2;
while (i <= num - 1)
{
if (num % i == 0)
{
Console.WriteLine("composite number: "+num);
break;
}
i++;
}
if (i == num)
Console.WriteLine("prime number: " + num);
Console.ReadLine();

}




so much information about C# Program to check number is prime or composite

just so much information about C# Program to check number is prime or composite , hopefully can provide benefits for you,

you just read the information about C# Program to check number is prime or composite if this article feel useful for you please bookmark or share again with link https://everythingnbeyondblog.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html thanks.

Tag : , , ,
Share on Facebook
Share on Twitter
Share on Google+

Related : C# Program to check number is prime or composite

0 komentar:

Posting Komentar