Advertisement
koksibg

Numbers

Aug 31st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 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.             int N = int.Parse(Console.ReadLine());
  14.             int a = N % 10;
  15.             int b = (N / 10) % 10;
  16.             int c = N / 100;
  17.             int row = c + b;
  18.             int col = c + a;
  19.             for (int i = 1; i <= row; i++)
  20.             {
  21.                 for (int j = 1; j <= col; j++)
  22.                 {
  23.                     if ((N % 3 == 0) && (N % 5 == 0)) N = N - c;
  24.                     else if (N % 3 == 0) N = N - b;
  25.                     else if (N % 5 == 0) N = N - c;
  26.                     else N = N + a;
  27.                     Console.Write(N + " ");
  28.                 }
  29.                 Console.WriteLine();
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement