1. Course
  2. Flow controls C
  3. ABS - Absolute value

ABS - Absolute value


Last updated: 8/23/2020 Difficulty: Easy

Write a program in C# to calculate and display the absolute value of a number x.

If the number is positive, its absolute value is exactly the number x. If it is negative, its absolute value is -x.

Input

7

Output

Absolute value is 7

Solution

Flow controls C

2 / 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