martinvalchev

Beverage_Labels

Jan 24th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Beverage_Labels
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string name = Console.ReadLine();
  10.             int volume = int.Parse(Console.ReadLine());
  11.             int energy = int.Parse(Console.ReadLine());
  12.             int sugar = int.Parse(Console.ReadLine());
  13.  
  14.             double energyTotal = (double)(energy) * volume / 100;
  15.             double sugarTotal = (double)(sugar) * volume / 100;
  16.  
  17.             Console.WriteLine($"{volume}ml {name}:");
  18.             Console.WriteLine($"{energyTotal}kcal, {sugarTotal}g sugars");
  19.  
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment