Info C# Program to check number is prime or composite - this blog we have built from a few years ago and already very much information about gadgets that we convey and a lot of blog visitors
New Blog Techno News who are satisfied with the information, we will always try to update the latest information for you, first about Info C# Program to check number is prime or composite many already we collect data to make this article so you do not miss the news, please see:
Articles :
Info C# Program to check number is prime or composite
full Link :
Info C# Program to check number is prime or composite
Article Csharp,
Article programming,
Article programs,
You can also see our article on:
Info 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 Info C# Program to check number is prime or composite finished in discussion
hopefully the information we convey about Info C# Program to check number is prime or composite can benefit you in getting new knowledge about technology,
you just finished reading the information Info C# Program to check number is prime or composite we hope this informmation can answer the question you submit to googlle, if you want to bookmark or share please use link https://moymoycikukecik.blogspot.com/2013/12/info-c-program-to-check-number-is-prime.html and do not forget to always visit this blog to get the latest information every day.
Tag :
Csharp,
programming,
programs,
0 komentar:
Posting Komentar