Advertisement
Niicksana

Stop Number

Dec 9th, 2017
146
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 Stop_Number
  8. {
  9.     class StopNumber
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 17 July 2016
  14.             int n = int.Parse(Console.ReadLine());
  15.             int m = int.Parse(Console.ReadLine());
  16.             int s = int.Parse(Console.ReadLine());
  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.  
  27.                     else
  28.                     {
  29.                         Console.Write("{0} ", i);
  30.                     }
  31.                 }
  32.             }
  33.             Console.WriteLine();
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement