Darwis Techno, MRT Dongle MTK Tool, AT&T to Compete with Verizon, Android TV, latest KitKat, stock firmware, Oppo Update Version Firmware Flash, Android Jelly Bean

C# Program to check number is prime or composite

C# Program to check number is prime or composite - every day there is always the latest gadget that is born, if we do not update the information then we will be outdated, even though we do not have the gadget but at least we know the information, on the blog Darwis Techno we are discussing a lot of information from various brands gadgets, now we will discuss first about C# Program to check number is prime or composite we have gathered information to make this article, please read to finish

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 completed in the discussion

hopefully the information C# Program to check number is prime or composite can provide benefits for you in providing information about the latest gadgets from various brands,

you just read the article about C# Program to check number is prime or composite if you intend to bookmark or share this information can use link https://laladarwis.blogspot.com/2013/12/c-program-to-check-number-is-prime-or.html thank you and do not forget to get back other information

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

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

  • HOW TO SIMULATE A BOUNCING BALL USING C++HEllo!!Bouncing ball simulation is really interesting in C++. It uses the header file <graphics.h> for drawing the ball, and here we also use http://laladarw ...
  • C# Main Function for Calling all classes http://laladarwis.blogspot.com /2014/02/c-main-function-for-calling-all-classes.html" rel="nofollow" target="_blank">C# Main Function for Calling all classes void Main_ ...
  • C# program to Check leap Year Using Conditional Statement C# program to Check Year is leap or not Using Conditional Statement Program Statement: Write a program using conditional operators to determine whether a year ...
  • Program to Print Armstrong numbers in C#C# Program to Print out all Armstrong numbers between 1 and 500Program Statement:Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of ...
  • C# Program to Print Fibonacci seriesC# Program to Print Fibonacci seriesProgram Statement:Write a program which prints the Fibonacci series using loop.1 1 2 3 5 8 13 21 34 …Solution: public class _fib { ...

0 komentar:

Post a Comment