Advertisement
TodorovP

Stop Number

Apr 4th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 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 _06_Stop_Number
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine()); //[0... < m
  14.             var m = int.Parse(Console.ReadLine()); //n < ...10000]
  15.             var s = int.Parse(Console.ReadLine()); //n <= s <= m
  16.  
  17.             int num = m;
  18.             bool stop = true;
  19.             while (stop)
  20.             {
  21.                 if (num == n) stop = false;
  22.                 if (num % 2 == 0 && num % 3 == 0)
  23.                 {
  24.                     if (num == s) stop = false;                    
  25.                     else Console.Write($"{num} ");                    
  26.                 }
  27.                 num--;
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement