C++ Program to Find the Absolute Value of a Number

Опубликовано: 03 Август 2026
на канале: MRTMentor
460
6

Hello and Welcome to C++ Programming Language.

1.In this program, we have declared an integer data type variable named n.

2.Then, the user is asked to enter an integer.

3.Now, we check whether the value of the entered integer is greater than zero or not. If the value is greater, then we print the number as it is as the absolute value.

4.Otherwise, if the entered number is less than zero then we multiply the value by -1 to get the absolute value.

If you have any question, then comment in comment section.

Practices : C++ Program to Convert Celsius to Kelvin

Thank You For Watching...

Join Telegram Channel
Source Code : https://t.me/mrtmentor

#education #onlineeducation #cplusplus #cplusplusprogramming #students #code