Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Operators | Styrstrukturer
C#-Grunder

bookChallenge: Operators

Uppgift

Swipe to start coding

  • Declare an int variable for the user's age.
  • Declare a bool variable for membership status.
  • Use comparison operators (>=) to check if age is 65 or older.
  • Use logical operators (||) to check if the user is a member.
  • Use a ternary operator (?:) to assign the message "Eligible for discount" or "Not eligible for discount" based on the conditions.
  • Print the message to the console using Console.WriteLine.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Operators

Svep för att visa menyn

Uppgift

Swipe to start coding

  • Declare an int variable for the user's age.
  • Declare a bool variable for membership status.
  • Use comparison operators (>=) to check if age is 65 or older.
  • Use logical operators (||) to check if the user is a member.
  • Use a ternary operator (?:) to assign the message "Eligible for discount" or "Not eligible for discount" based on the conditions.
  • Print the message to the console using Console.WriteLine.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

some-alt