StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 4. Program to find the greatest common divisor (GCD).
Download
  1. C++ Programs list
3. Program to check if a given number is a palindrome. : 5. Program to find the roots of a quadratic equation.
C++ Programs list

1.      Program to find the greatest common divisor (GCD).

  1. #include <iostream.h>

  2. #include <conio.h>

  3. int gcd(int a, int b) {

  4.     if (b == 0)

  5.         return a;

  6.     return gcd(b, a % b);

  7. }

  8. int main() {

  9.     int num1, num2, result;

  10.     cout << "Enter two numbers: ";

  11.     cin >> num1 >> num2;

  12.     result = gcd(num1, num2);

  13.     cout << "GCD of " << num1 << " and " << num2 << " is " << result << endl;

  14.     getch();

  15.     return 0;

  16. }

3. Program to check if a given number is a palindrome. 5. Program to find the roots of a quadratic equation.
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website