MiroslavKisov

Stop_Number

Jul 28th, 2017
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 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 Stop_Number
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int N = int.Parse(Console.ReadLine());
  14.             int M = int.Parse(Console.ReadLine());
  15.             int S = int.Parse(Console.ReadLine());
  16.             if (S % 2 == 0 && S % 3 == 0)
  17.             {
  18.                 for (int i = M; i >= N; i--)
  19.                 {
  20.                     if (i % 2 == 0 && i % 3 == 0)
  21.                     {
  22.                         if (i == S)
  23.                         {
  24.                             break;
  25.                         }
  26.                         Console.Write(i + " ");
  27.                     }
  28.                 }
  29.             }
  30.             else
  31.             {
  32.                 for (int i = M; i >= N; i--)
  33.                 {
  34.                     if (i % 2 == 0 && i % 3 == 0)
  35.                     {
  36.                         Console.Write(i + " ");
  37.                     }
  38.                 }
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment