Techno Life, Micromax New Version Official Firmware, Winmax official firmware, Nokia Flash File, WhatsApp Messenger, Lenovo, huawei, xiaomi, samsung galaxy

Cari Blog Ini

Diberdayakan oleh Blogger.
Selasa, 24 Desember 2013

C# Program to check number is prime or composite

C# Program to check number is prime or composite - these days more and more blogs that talk about technology, including blogs Techno Life but we are very experienced in this case because we have been there from a few years ago always present information about techno for you, well now we are about C# Program to check number is prime or composite hopefully the information we will convey can answer your question to google, 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 has been discussed

hopefully the meaning of C# Program to check number is prime or composite that we write can be useful for you in adding insight about gadgets.

you just finished reading the article titled C# Program to check number is prime or composite if you want to bookmark or share your links use the link https://lifeandeating.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html do not forget to go back to this blog if you want to get the latest information about gadgets.

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

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

1 komentar:

  1. The crucial Black Friday event is arriving on the 29th of November this Black Friday. The advertisement has not been released yet which gives the specific offer details about upcoming West Marine Black Friday Sale.

    BalasHapus