Republic Gadget, Windows Phone, Asansam box Version, Z3X BOX Samsung, How to Backup, iPhone 7 to PC/Mac, Korea Telecom

C# Program to check number is prime or composite

C# Program to check number is prime or composite - the world of technology is more advanced, we should be technically literate so as not left behind by others, in blogs Republic Gadget we will present updated information about technological developments, product reviews from various brands, now we will discuss first about this information C# Program to check number is prime or composite we cover directly from reliable 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();

}




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

hopefully the infromation that we show for you about C# Program to check number is prime or composite can provide the latest knowledge about the gadgets you need in everyday life.

you've just read the article with the title C# Program to check number is prime or composite if you intend to bookmark or share it for many people please use the link https://bhrepublicadominicana.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html still a lot of information on this blog, please 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