Bob103

C#_for_Nigga_(V-5-№9)

Apr 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. class Program
  2. {
  3.     static void FindFactors(int n, int i = 2)
  4.     {
  5.         if (n % i == 0)
  6.             Console.Write(i + " ");
  7.         if (i == n / 2) return;
  8.         FindFactors(n, ++i);
  9.     }
  10.     static void Main()
  11.     {
  12.         Console.Write("Enter N:);
  13.        int N = int.Parse(Console.ReadLine());
  14.        Console.WriteLine("Number of dividers:{0}",FindFactors(N));
  15.    }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment