Advertisement
fbinnzhivko

Цифри

Aug 28th, 2016
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. class Program
  3.     {
  4.         static void Main()
  5.         {
  6.             int n = int.Parse(Console.ReadLine());
  7.  
  8.             int first = n / 100;
  9.             int secound = (n / 10) % 10;
  10.             int third = n % 10;          
  11.  
  12.             int row = first + secound;
  13.             int coloum = first + third;
  14.  
  15.             for (int i = 0; i < row; i++)
  16.             {
  17.                 for (int j = 0; j < coloum; j++)
  18.                 {
  19.                     if (n % 5 == 0)
  20.                     {
  21.                         n = n - first;
  22.                     }
  23.                     else if (n % 3 == 0)
  24.                     {
  25.                         n = n - secound;
  26.                     }                    
  27.                     else
  28.                     {
  29.                         n = n + third;
  30.                     }                    
  31.                     Console.Write("{0} ",n);                    
  32.                 }
  33.                 Console.WriteLine();
  34.             }
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement