diff --git a/12-5-20/Q1.cpp b/12-5-20/Q1.cpp new file mode 100644 index 0000000..9f08c0d --- /dev/null +++ b/12-5-20/Q1.cpp @@ -0,0 +1,26 @@ +#include +//Q1. Divisor Game +#include +using namespace std; +int main() +{ + int A,B,C; + int count=0; + cout<<"enter A"<>A; + cout<<"enter B"<>B; + cout<<"enter C"<>C; + + int ar[]={A,B,C}; + + for(int i=1;i<=A;i++) + { + if(i%B==0 && i%C==0 ) + { + count++; + } + } + cout<<"output:- "< +#include +using namespace std; +//Function to return gcd of a and b +int gcd(int a,int b) +{ + if(a==0) + return b; + return gcd(b%a,a); +} + +int main() +{ + int A,B,D; + cout<<"enter A"<>A; + cout<<"enter B"<>B; + int a=A; + int b=B; + + cout<<"The GCD between A and B is :-"<