This blog displays information about the latest android smartphone, price and specs as well as information applikaksi game that appeals to you, here are also a lot of software that you can download

Selasa, 24 Desember 2013

C# Program to check number is prime or composite

C# Program to check number is prime or composite - is looking for information, and in this blog Android Gadgets we have been providing very complete information from various sources that reliable, well we'll talk about the C# Program to check number is prime or composite as you need, please si read to completion.

Articles : C# Program to check number is prime or composite
full Link : C# Program to check number is prime or composite

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 C# Program to check number is prime or composite has been discussed

A few gadget information C# Program to check number is prime or composite , hopefully can provide benefits to you all.

You're reading an article C# Program to check number is prime or composite and this article url is https://androidtabletgadgets.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html you can bookmark , Hopefully this article could be useful and do not forget to always to this blog to find information on gadget.

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

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

0 komentar:

Posting Komentar