Завдання: Умова If
Напишіть if-умову, яка перевіряє, чи знаходиться змінна x
у діапазоні від 40 до 70 (включно 40 і 70). Використовуйте оператори <=
для порівняння. Якщо умова істинна, має виводитися "In Range
".
main.cs
12345678910111213141516using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line // Write code above this line } } }
Синтаксис if-умови:
if(condition) { /* code to execute */ }
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line if (40 <= x && x <= 70) { Console.WriteLine("In Range"); } // Write code above this line } } }
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 6
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 1.59
Завдання: Умова If
Свайпніть щоб показати меню
Напишіть if-умову, яка перевіряє, чи знаходиться змінна x
у діапазоні від 40 до 70 (включно 40 і 70). Використовуйте оператори <=
для порівняння. Якщо умова істинна, має виводитися "In Range
".
main.cs
12345678910111213141516using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line // Write code above this line } } }
Синтаксис if-умови:
if(condition) { /* code to execute */ }
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 55; // Write code below this line if (40 <= x && x <= 70) { Console.WriteLine("In Range"); } // Write code above this line } } }
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 6