You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
706 B
C#

/*
* C# Program to Display the Factors of the Entered Number
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
class Program
{
static void Main(string[] args)
{
int num, x;
Console.WriteLine("Enter the Number ");
num = int.Parse(Console.ReadLine());
Console.WriteLine("The Factors are : ");
for (x = 1; x <= num; x++)
{
if (num % x == 0)
{
Console.WriteLine(x);
}
}
Console.ReadLine();
}
}
}
/*
Enter the Number : 27
The Factors are :
1
3
9
27