# Program in C Plus Plus and C with explanation to find the Greatest Common Division (GCD) with flowchart

Last modified on May 26th, 2018 at 2:03 pm

**Program in C Plus Plus and C with explanation to find the Greatest Common Division (GCD) with flowchart**

In this tutorial, we will learn about the followings;

- Flowchart of the program to find the Greatest Common Division (GCD)
- Program in C Plus Plus with an explanation to find the Greatest Common Division (GCD)
- Program in C with an explanation to find the Greatest Common Division (GCD)

**Flowchart of the program to find the Greatest Common Division (GCD) **

**Program in C Plus Plus with an explanation to find the Greatest Common Division (GCD) **

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<iostream> #include<conio.h> using namespace std; int main() { int h,i; cout<<"Program: Find GCD Of Given Numbers"; cout<<"\n Welcome to T4TUTorials! Please Enter 1st Number="; cin>>h; cout<<" Welcome to T4TUTorials! Please Enter 2nd Number="; cin>>i; while(h!=i) { if(h>i) h=h-i; else i=i-h; } cout<<"The Greatest Common Division (GCD): "<<h; } |

**Output**

**Program in C with an explanation to find the Greatest Common Division (GCD) **

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<stdio.h> int main() { int h,i; printf("Welcome to T4TUTorials! Please Enter 1st Number="); scanf("%d", &h); printf("\n Welcome to T4TUTorials! Please Enter 2nd Number="); scanf("%d", &i); while(h!=i) { if(h>i) h=h-i; else i=i-h; } printf("\n The G.C.D Of Given Number is =:%d",h); } |

**Output**

**Figure:** Program in C Plus Plus and C with an explanation to find the Greatest Common Division (GCD) with the flowchart.