Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _2.Divison
- {
- class Program
- {
- static void Main(string[] args)
- {
- //2,3,6,7,10
- int Num = int.Parse(Console.ReadLine());
- int MaxDiv = 0;
- if (Num%10==0)
- {
- MaxDiv = 10;
- Console.WriteLine($"The number is divisible by {MaxDiv}");
- }
- else if (Num % 7 == 0)
- {
- MaxDiv = 7;
- Console.WriteLine($"The number is divisible by {MaxDiv}");
- }
- else if (Num % 6 == 0)
- {
- MaxDiv = 6;
- Console.WriteLine($"The number is divisible by {MaxDiv}");
- }
- else if (Num % 3 == 0)
- {
- MaxDiv = 3;
- Console.WriteLine($"The number is divisible by {MaxDiv}");
- }
- else if (Num % 2 == 0)
- {
- MaxDiv = 2;
- Console.WriteLine($"The number is divisible by {MaxDiv}");
- }
- else
- {
- Console.WriteLine("Not divisible");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment