lundi 14 septembre 2020

I encountered arithmetic error in my code while calculating GCD of integer [closed]

enter image description here

help me to solve this code i am encountering error in 5 line of code, it's arithmetic exception

#include<iostream>
using namespace std;
int64_t GCD(int64_t a,int64_t b){
    
     int64_t r;
     r= a%b;
     if (b==0){
            return a;
     }
     else{
        return GCD(b,r);
     }

}
int main(){
    int64_t a,b;
    cin>>a>>b;
    cout<<"\n THE GREATEAT COMMON DIVISIOR :"<<GCD(a,b);
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire