Coders Packet

C++ program to Find GCD of two numbers

By Aalok Kumar

Hello Programmers, This C++ program finds GCD of two numbers using the Bitwise XOR operator.

This program finds GCD of two numbers a and b using Bit Manipulation.

The function gcd_(int a, int b) takes two integers a and b as arguments and returns an integer, the resulting GCD.

The first line of input takes the first number a.

The next line takes the second number b.

Below is the sample output of the program:

Enter first number: 100
Enter second number: 95
GCD of 100 and 95 is: 5

Enter first number: 47
Enter second number: 11
GCD of 47 and 11 is: 1


Download project

Reviews Report

Submitted by Aalok Kumar (Aaloks766626)

Download packets of source code on Coders Packet