C# Program to Find All Factors of the Given Number

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Collections;

using System.Threading;

using System.IO;


namespace CSharpProgram

{

    class AkbTechie

     {

            static void Main(string[] args)

           {

               int num;

               Console.WriteLine("Enter the Number :");

               num = int.Parse(Console.ReadLine());

               Console.WriteLine("The Factors of Given Numbers are : ");

               for (int i = 1; i <= num; i++)

               {

                   if (num % i == 0)

                   {

                       Console.WriteLine(i);

                   }

               }            

            Console.ReadKey(); 

          }

    }

}


Enter the Number :

12

The Factors of Given Numbers are :

1

2

3

4

6

12


एक टिप्पणी भेजें

0 टिप्पणियाँ