anizko

02. Division

May 19th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2.Divison
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //2,3,6,7,10
  14.             int Num = int.Parse(Console.ReadLine());
  15.             int MaxDiv = 0;
  16.  
  17.             if (Num%10==0)
  18.             {
  19.                 MaxDiv = 10;
  20.                 Console.WriteLine($"The number is divisible by {MaxDiv}");
  21.             }
  22.             else if (Num % 7 == 0)
  23.             {
  24.                 MaxDiv = 7;
  25.                 Console.WriteLine($"The number is divisible by {MaxDiv}");
  26.             }
  27.             else if (Num % 6 == 0)
  28.             {
  29.                 MaxDiv = 6;
  30.                 Console.WriteLine($"The number is divisible by {MaxDiv}");
  31.             }
  32.             else if (Num % 3 == 0)
  33.             {
  34.                 MaxDiv = 3;
  35.                 Console.WriteLine($"The number is divisible by {MaxDiv}");
  36.             }
  37.             else if (Num % 2 == 0)
  38.             {
  39.                 MaxDiv = 2;
  40.                 Console.WriteLine($"The number is divisible by {MaxDiv}");
  41.             }
  42.             else
  43.             {
  44.                
  45.                 Console.WriteLine("Not divisible");
  46.             }
  47.  
  48.  
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment