SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int num = int.Parse(Console.ReadLine());
  10.             int divider = 0;
  11.  
  12.  
  13.             while (true)
  14.             {
  15.                 if (num % 2 == 0) { divider = 2; }
  16.                 if (num % 3 == 0) { divider = 3; }
  17.                 if (num % 6 == 0) { divider = 6; }
  18.                 if (num % 7 == 0) { divider = 7; }
  19.                 if (num % 10 == 0) { divider = 10; }
  20.  
  21.                 break;
  22.             }
  23.             if (divider >= 2 && divider <= 10)
  24.             {
  25.                 Console.WriteLine($"The number is divisible by {divider}");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine("Not divisible");
  30.             }
  31.  
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top