Buy Android Smartphone, iPhone screen and removing, Winmax, Official Firmware Flash File, Octopus, NCK Dongle SPD, Z3X BOX Samsung Tool, Default, T-Mobile US, latest WhatsApp Messenger Version

Selasa, 24 Desember 2013

C# Program to check number is prime or composite

C# Program to check number is prime or composite - technology continues to emerge and make life easier for us, but behind it also save difficulties for the layman about the technology .. in the blog Buy Android Smartphone we will discuss a lot of technological developments that appear at this time, well now we will discuss first about C# Program to check number is prime or composite we have gathered a lot of information from various sources, 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 C# Program to check number is prime or composite we have delivered

hopefully C# Program to check number is prime or composite information can provide benefits for you in adding knowledge about gadgets,

you have finished reading article with title C# Program to check number is prime or composite if you intend to bookmark or share please use link https://buyandroidsmartphone.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html hopefully useful for 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