Advertisement
Pazzobg

Programming Basics Exams/28AUG16/06. Numbers

Mar 11th, 2017
133
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.  
  3. namespace _20.Numbers
  4. {
  5.     class Numbers
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int input = int.Parse(Console.ReadLine());
  10.             int inputBreak = input;
  11.             int thirdDigit = inputBreak % 10;
  12.             inputBreak /= 10;
  13.             int secondDigit = inputBreak % 10;
  14.             inputBreak /= 10;
  15.             int firstDigit = inputBreak % 10;
  16.             int rowLength = firstDigit + secondDigit;
  17.             int colLength = firstDigit + thirdDigit;
  18.  
  19.             for (int row = 0; row < rowLength; row++)
  20.             {
  21.                 for (int col = 0; col < colLength; col++)
  22.                 {
  23.                     if (input % 5 == 0) input -= firstDigit;
  24.                     else if (input %3 == 0) input -= secondDigit;
  25.                     else input += thirdDigit;
  26.                     Console.Write($"{input} ");
  27.                 }
  28.                 Console.WriteLine();
  29.             }
  30.             Console.WriteLine();
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement