Advertisement
Nikolcho

Softuni задача: 06. Profit

Dec 16th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 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 _06.Profit
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             var inOne = int.Parse(Console.ReadLine());
  15.             var inTwo = int.Parse(Console.ReadLine());
  16.             var inThree = int.Parse(Console.ReadLine());
  17.             var Sum = int.Parse(Console.ReadLine());          
  18.  
  19.             for (int i = 0; i <= inOne; i++)
  20.             {
  21.                 for (int k = 0; k <= inTwo; k++)
  22.                 {
  23.                     for (int l = 0; l <= inThree; l++)
  24.                     {
  25.                         if (i * 1 + k * 2 + l * 5 == Sum)
  26.                         {
  27.                             Console.WriteLine($"{i} * 1 lv. + {k} * 2 lv. + {l} * 5 lv. = {Sum} lv.");
  28.                         }                      
  29.                     }
  30.                 }
  31.             }
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement