# Category: C++ Programs

• ## C++ Program to Find LCM using while loop

Introduction This program will help you find to find the LCM of two positive numbers. The task is that the user will be asked to enter two integers and then through this program, the LCM of both numbers will be computed. LCM: Least Common Multiple. A positive integer that is perfectly divisible by both numbers…

• ## C++ Program to Calculate Power of a Number

Introduction In this program, you will learn to calculate the power of a number. The user will be asked to enter an integer as the base value and the power value, which will be the exponent of the base number. For example, 9 raised to power 3 means 93= 9*9*9=721, where 9 is the base…

• ## C++ program to add 2 in each digit of the integer value

Introduction In this program, you will learn to add 2 in all the digits of the integer value entered by the user in the C++ language. For example, if the number is 98542, then this code will add 2 in all the digits of 98542. This happens as follows 9+2=11; 8+2=10; 5+2=7; 4+2=6; 2+2=4 and…

• ## C++ Program to Find GCD (Using ‘for’ loop for both negative and positive integers)

Introduction This program will help you to find the GCD of two numbers. The task is that the user will be asked to enter two integers, and then through this program GCD of both numbers will be computed. GCD: Greatest common divisor, which is also called as Highest common factor (HCF) The largest common number…

• ## C++ Program to calculate the sum of the digits of a number

Introduction In this program, you will learn to calculate the sum of the digits of the integer value entered by the user in the C++ language. For example, the number is 98542, and then this code will add all the digits of 98542 i.e., 9+8+5+4+2=28, and return 28 as output. To understand the program, learn…

• ## C++ Program to Reverse a Number

Introduction In this program, you will learn to reverse the digits of the integer value entered by the user in the C++ language. For example, if the number is 98542, then this code will reverse the number, and the output will be 24589. To understand the program, learn the following basic concepts of C++ programming…

• ## C++ Program to Find LCM using GCD

Introduction This program will help you find to find the LCM of two positive numbers. The task is that the user will be asked to enter two integers, and then through this program, the LCM of both numbers will be computed. LCM: Least Common Multiple. A positive integer that is perfectly divisible by both numbers…

• ## C++ Program to Find LCM using while loop

Introduction This program will help you find to find the LCM of two positive numbers. The task is that the user will be asked to enter two integers, and then through this program, the LCM of both numbers will be computed. LCM: Least Common Multiple. A positive integer that is perfectly divisible by both numbers…

• ## C++ Program to Find GCD (Using while loop for both negative and positive integers)

Introduction This program will help you to find the GCD of two numbers. The task is that the user will be asked to enter two integers, and then through this program GCD of both numbers will be computed. GCD: Greatest common divisor, which is also called as Highest common factor (HCF) The largest common number…

• ## C++ Program to Find GCD (Using while loop)

Introduction This program will help you to find the GCD of two numbers. The task is that the user will be asked to enter two integers, and then through this program GCD of both numbers will be computed. GCD: Greatest common divisor, which is also called as Highest common factor (HCF) The largest common number…