Advertisement
sivancheva

Problem 4. Beverage Labels

Jul 28th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7.  
  8. string name = Console.ReadLine();
  9. decimal volume = decimal.Parse(Console.ReadLine()); //
  10. decimal energy = decimal.Parse(Console.ReadLine())/100m; // energy /ml
  11. decimal sugar = decimal.Parse(Console.ReadLine())/100m; //
  12.  
  13.  
  14. decimal energyTotal = volume*energy;
  15. decimal sugarTotal = volume*sugar;
  16.  
  17. Console.WriteLine("{0}ml {1}:\n{2:f1}kcal, {3:f1}g sugars", volume, name, energyTotal, sugarTotal);
  18.  
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement