• Сделал программу, но она не считает((( в чем причина? Помогите)

    question img

Ответы 4

  • переменные a,b,c лучше на начале дикларировать. Плюс у тебя else не закрытый. А если клавиша 2 для тебя выход из Свитча можешь использовать вместо Case - default и просто останавливать свитч.
  • Спасибо огромное!))
  • Дерзай !
    • Автор:

      presley16
    • 6 лет назад
    • 0
  • using System; public class Program{ public static void Main() { Console.WriteLine("Enter 1 to start the shit 2 to quit "); int n = int.Parse(Console.ReadLine()); int a,b,c; switch(n){ case 1: Console.WriteLine("Enter your distance: "); a = int.Parse(Console.ReadLine()); Console.WriteLine("litres per kilometr: "); b = int.Parse(Console.ReadLine()); Console.WriteLine("gas in machine right now: "); c = int.Parse(Console.ReadLine()); if (c/b < a){ Console.WriteLine("Ne hvatit"); }else{ Console.WriteLine("Hvatit"); } break; default: Console.WriteLine("Well not today"); break; } }}
    • Автор:

      moose50
    • 6 лет назад
    • 0
  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years