Herausforderung: If-Bedingung
Schreibe eine if-Bedingung, die prüft, ob die Variable x im Bereich von 40 bis 70 liegt (einschließlich 40 und 70). Verwende die Operatoren <= für den Vergleich. Wenn die Bedingung erfüllt ist, soll "In Range" ausgegeben werden.
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 } } }
Die Syntax einer if-Bedingung ist:
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 } } }
Danke für Ihr Feedback!
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Can you show me an example of how to write this if-condition in code?
What does the output look like if `x` is not in the range?
Can you explain how the `<=` operator works in this context?
Großartig!
Completion Rate verbessert auf 1.56
Herausforderung: If-Bedingung
Swipe um das Menü anzuzeigen
Schreibe eine if-Bedingung, die prüft, ob die Variable x im Bereich von 40 bis 70 liegt (einschließlich 40 und 70). Verwende die Operatoren <= für den Vergleich. Wenn die Bedingung erfüllt ist, soll "In Range" ausgegeben werden.
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 } } }
Die Syntax einer if-Bedingung ist:
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 } } }
Danke für Ihr Feedback!