Tecno Mobile Phones, Huawei, Firmware Flash File, Android Jelly Bean, Facebook Page, iPhone Apple, Symphony Firmware, Lava iris, samsung

C# Program to check number is prime or composite

C# Program to check number is prime or composite - technological developments continue to grow rapidly, old technologist replaced with the latest, on the blog Tecno Mobile Phones we will discuss various updated technology from various brands around the world, well now we will discuss first about C# Program to check number is prime or composite we collect a lot data from various reliable sources to make this article, please read:

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();

}




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

hopefully C# Program to check number is prime or composite information can provide benefits for you in adding insight about the latest gadget technology

you just read the article about C# Program to check number is prime or composite and can you bookmark or share with link https://ghchjgv.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html so thank you.

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

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

0 komentar:

Post a Comment