Techno Specs Gadget, Samsung Galaxy, New IMEI, Octopus Box Samsung, Android Jelly Bean, Ulefone Tiger, Chinese Miracle

Selasa, 24 Desember 2013

C# Program to check number is prime or composite

C# Program to check number is prime or composite - are you surfing on google and finding this blog Techno Specs Gadget ?.. if yes, congratulations you will get updated information about C# Program to check number is prime or composite we have collected a lot of information from various reliable sources to make this article, so make sure you read through to finish, 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();

}




information about C# Program to check number is prime or composite has been completed in the discussion

hopefully the information C# Program to check number is prime or composite that we provide can provide benefits for you in finding the information you need

you have finished reading the article about C# Program to check number is prime or composite if you want to bookmark or also want to share this information to many people can use the link http://belialslut.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html ok so and thank you.

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

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

0 komentar:

Posting Komentar