Advertisement
Dianov

Basic Syntax, Conditional Statements and Loops - Exercise (02. Division)

Mar 26th, 2021
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 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 Division
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int number = int.Parse(Console.ReadLine());
  15.  
  16.             if (number % 10 == 0)
  17.             {
  18.                 Console.WriteLine("The number is divisible by 10");
  19.             }
  20.             else if (number % 7 == 0)
  21.             {
  22.                 Console.WriteLine("The number is divisible by 7");
  23.             }
  24.             else if (number % 6 == 0)
  25.             {
  26.                 Console.WriteLine("The number is divisible by 6");
  27.             }
  28.             else if (number % 3 == 0)
  29.             {
  30.                 Console.WriteLine("The number is divisible by 3");
  31.             }
  32.             else if (number % 2 == 0)
  33.             {
  34.                 Console.WriteLine("The number is divisible by 2");
  35.             }
  36.             else
  37.             {
  38.                 Console.WriteLine("Not divisible");
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement