Tecno Android Phones, Samsung Imei Repair, Huawei Mediapad, Official Firmware/ Flash File, WiFi, Alcatel One, Flash Tool Windows, Android Jelly Bean

C# Program to check number is prime or composite

C# Program to check number is prime or composite - we say welcome to the blog Tecno Android Phones we provide a lot of latest gadget information that must be very dear for you to miss, now we will discuss first about C# Program to check number is prime or composite we have collected a lot of information to make this article to complete for you, 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();

}




Articles about C# Program to check number is prime or composite finished discussed

We think it is enough information about C# Program to check number is prime or composite , hopefully the information we give can give benefit for you,

If you feel the information C# Program to check number is prime or composite that we provide can provide benefits for others please share with link https://southernmatron.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html thank you for visiting our blog page and do not forget to visit other pages.

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