Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Operators | Control Structures
C# Basics

bookChallenge: Operators

Task

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.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Operators

Swipe to show menu

Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
single

single

some-alt