Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Haaste: If, Else-If, Else | Ohjausrakenteet
Quizzes & Challenges
Quizzes
Challenges
/
C# Perusteet

bookHaaste: If, Else-If, Else

Write a condition for checking if the variable x is in the numerical range 70 to 90 (including 70 and 90). If it is in range, output the message "In Range", otherwise output "Not In Range".

main.cs

main.cs

copy
123456789101112131415161718192021
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 77; if (___) { ___ } ___ { ___ } } } }

Modify the values in the expression 0 <= value && value <= 100 for forming the conditional expression.

main.cs

main.cs

copy
123456789101112131415161718192021
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 77; if (70 <= x && x <= 90) { Console.WriteLine("In Range"); } else { Console.WriteLine("Not In Range"); } } } }

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 10

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

What should the modified conditional expression look like for the range 70 to 90?

Can you explain how to change the values in the expression for a different range?

Could you show an example using a different variable name?

bookHaaste: If, Else-If, Else

Pyyhkäise näyttääksesi valikon

Write a condition for checking if the variable x is in the numerical range 70 to 90 (including 70 and 90). If it is in range, output the message "In Range", otherwise output "Not In Range".

main.cs

main.cs

copy
123456789101112131415161718192021
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 77; if (___) { ___ } ___ { ___ } } } }

Modify the values in the expression 0 <= value && value <= 100 for forming the conditional expression.

main.cs

main.cs

copy
123456789101112131415161718192021
using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int x = 77; if (70 <= x && x <= 90) { Console.WriteLine("In Range"); } else { Console.WriteLine("Not In Range"); } } } }

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 10
some-alt