GCD or HCF of 2 Number using Recursion in C - 👑 सार्थक मुंड S3 🤴🏻

GCD or HCF of 2 Number using Recursion in C

GCD or HCF of 2 Number using Recursion in C

GCD(Greatest Common Divisor) or HCF(Highest Common Factor) of 2 number using Recursion in C Programming

#include <stdio.h>
int gcd(int n1, int n2);
int main() {
    int n1, n2;
    printf("Enter two positive Numbers : \n");
    scanf("%d %d", &n1, &n2);
    printf("G.C.D of %d and %d is : %d", n1, n2, gcd(n1, n2));
    return 0;
}
int gcd(int n1, int n2) {
    if (n2 != 0)
        return gcd(n2, n1 % n2);
    else
        return n1;
}
OUTPUT :
Enter two positive Numbers :
366
60
G.C.D of 366 and 60 is : 6
Previous article
Next article

1 Comments

  1. Alright...

    This might sound really creepy, and maybe even a little "supernatural"

    HOW would you like it if you could simply press "Play" to LISTEN to a short, "magical tone"...

    And INSTANTLY bring MORE MONEY to your life?

    And I'm talking about BIG MONEY, even MILLIONS of DOLLARS!!

    Sounds way too EASY? Think it couldn't possibly be REAL?!?

    Well then, I'll be the one to tell you the news..

    Usually the most significant blessings in life are the easiest to GET!!

    Honestly, I will PROVE it to you by letting you listen to a REAL "miracle money-magnet tone" I've synthesized...

    YOU simply press "Play" and the money will start coming into your life... starting so fast, you will be surprised...

    CLICK here NOW to play the mysterious "Miracle Wealth Building TONE" - as my gift to you!!

    ReplyDelete

Articles Ads

Articles Ads 1

Articles Ads 2

Advertisement Ads