Advertisement
drunin89

Numbers

Nov 24th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 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 Numbers
  8. {
  9.     class Numbers
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int num = int.Parse(Console.ReadLine());
  15.             int a = num / 100;
  16.             int b = num % 100 / 10;
  17.             int c = num % 100 % 10;
  18.             int row = a + b;
  19.             int column = a + c;
  20.             int num2 = num;
  21.             for (int i = 1; i <= row; i++)
  22.             {
  23.                 for (int j = 1; j <= column; j++)
  24.                 {
  25.  
  26.                     if (num2 % 5 == 0)
  27.                     {
  28.                         num2 -= a;
  29.                         Console.Write("{0} ", num2);
  30.                     }
  31.                     else if (num2 % 3 == 0)
  32.                     {
  33.                         num2 -= b;
  34.                         Console.Write("{0} ",num2);
  35.                     }
  36.  
  37.                     else
  38.                     {
  39.                         num2 += c;
  40.                         Console.Write("{0} ", num2);
  41.                     }
  42.                     if (j == column)
  43.                     {
  44.                         Console.WriteLine();
  45.                     }
  46.  
  47.                 }
  48.  
  49.             }
  50.    
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement