1. Course
  2. Flow controls C
  3. Conditional operator

Conditional operator


Last updated: 8/23/2020 Difficulty: Intermediate

Create a C# program which asks the user for two numbers and answers, using the conditional operator (?), the following:

  • If the first number is positive
  • If the second number is positive
  • If they are both positive

Input

6
4

Output

A is positive                                
B is positive                               
Both are positive

Solution

Flow controls C

7 / 8

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising