Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Digits
- {
- class Digits
- {
- static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- int firstDigit = number / 100;
- int secondDigit = (number / 10) % 10;
- int thirdDigit = number % 10;
- int rows = firstDigit + secondDigit;
- int cols = firstDigit + thirdDigit;
- for (int currRow = 0; currRow < rows; currRow++)
- {
- for (int currCol = 0; currCol < cols; currCol++)
- {
- if (number % 5 == 0)
- {
- //vadim puva cifra
- number -= firstDigit;
- }
- else if (number % 3 == 0)
- {
- //vadim vtora cifra
- number -= secondDigit;
- }
- else
- {
- //pribavqme tretata cifra
- number += thirdDigit;
- }
- Console.Write($"{number} ");
- }
- Console.WriteLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment