Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp7
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int Owndogs = int.Parse(Console.ReadLine());
  10.             int OtherAnimals = int.Parse(Console.ReadLine());
  11.             //string currency = "lv."; излишно
  12.  
  13.             double price = 2.50;
  14.             double price1 = 4;
  15.             double totalprice = Owndogs * price;
  16.             double totalprice2 = OtherAnimals * price1;
  17.  
  18.             // double result = totalprice + totalprice2;  // <= този начин е по лесен и по малко се пише и 90 % го правят така
  19.             // Console.WriteLine("{result:f2} lv."); // вярно
  20.  
  21.             Console.WriteLine("{0:F2} lv.", totalprice + totalprice2); // вярно
  22.  
  23.             // Console.WriteLine("{0:F2}", totalprice + totalprice2 + "lv."); // грешно
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement