bacco

Таблица за умножение

Feb 23rd, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Купа
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             var oneN = n / 100 % 10;
  12.             var twoN = n / 10 % 10;
  13.             var threeN = n % 10;      
  14.  
  15.             for (int a = 1; a <= threeN; a++)
  16.             {
  17.                 for (int b = 1; b <= twoN; b++)
  18.                 {
  19.                     for (int c = 1; c <= oneN; c++)
  20.                     {
  21.                         var sum = a * b * c;
  22.                         Console.WriteLine($"{a} * {b} * {c} = {sum};");
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
  29.  
  30.  
  31. //                       Таблица за умножение
  32.  
  33. //                       222
  34.  
  35. //                       1 * 1 * 1 = 1;
  36. //                       1 * 1 * 2 = 2;
  37. //                       1 * 2 * 1 = 2;
  38. //                       1 * 2 * 2 = 4;
  39. //                       2 * 1 * 1 = 2;
  40. //                       2 * 1 * 2 = 4;
  41. //                       2 * 2 * 1 = 4;
  42. //                       2 * 2 * 2 = 8;
Advertisement
Add Comment
Please, Sign In to add comment