Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Program
- {
- internal class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine("Zadejte počet kilometrů");
- int km = int.Parse(Console.ReadLine());
- int sazba_1 = 10;
- int sazba_2 = 20;
- int sazba_3 = 50;
- int cena;
- //do 10km
- if (km > 0 && km <= 10)
- {
- cena = sazba_1 * km;
- Console.Write("Výsledná cena jen a jen pro vás bude přesně ");
- Console.Write(cena);
- Console.WriteLine(" Kč");
- }
- //do 20 km
- else if (km > 10 && km <= 20)
- {
- cena = sazba_2 * (km - 10) + sazba_1 * 10;
- Console.Write("Výsledná cena jen a jen pro vás bude přesně ");
- Console.Write(cena);
- Console.WriteLine(" Kč");
- }
- //nad 20 km
- else if (km > 20)
- {
- cena = sazba_3 * (km - 20) + sazba_2 * 10 + sazba_1 * 10;
- Console.Write("Výsledná cena jen a jen pro vás bude přesně ");
- Console.Write(cena);
- Console.WriteLine(" Kč");
- }
- //kdyby někdo byl píča
- else
- {
- Console.WriteLine("Víc než 0 km");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment