menu search
person
Write an Object Oriented Program in C++, to find the GCD of two given numbers.

Given numbers are 225 , 45
thumb_up_alt 50 like thumb_down_alt 0 dislike
14 views

1 Answer

 
verified

#include <iostream>

using namespace std;


int gcd(int a, int b) {

   if (b == 0)

   return a;

   return gcd(b, a % b);

}

int main() {

   int a = 225, b = 45;

   cout<<"GCD of TWO NUMBERS"<< a <<" and "<< b <<" is "<< gcd(a, b);

   return 0;

}

image

thumb_up_alt 50 like thumb_down_alt 0 dislike

Related questions

thumb_up_alt 50 like thumb_down_alt 0 dislike
3 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
4 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
3 views 1 answer
thumb_up_alt 51 like thumb_down_alt 0 dislike
523 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
6 views 1 answer

1,904 questions

1,584 answers

13 comments

69 users

Welcome to Brainiak.in , where you can ask questions and receive answers from other members of the community ,

There is many categories for every students  CBSE , Maharashtra board , JEE , NEET  and we will add more categories

and make brainiak one of the most loved community of students

add_circle_outline
...