Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions 12-5-20/Q1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<stdio.h>
//Q1. Divisor Game
#include<bits/stdc++.h>
using namespace std;
int main()
{
int A,B,C;
int count=0;
cout<<"enter A"<<endl;
cin>>A;
cout<<"enter B"<<endl;
cin>>B;
cout<<"enter C"<<endl;
cin>>C;

int ar[]={A,B,C};

for(int i=1;i<=A;i++)
{
if(i%B==0 && i%C==0 )
{
count++;
}
}
cout<<"output:- "<<count<<endl;
}
Binary file added 12-5-20/Q1.exe
Binary file not shown.
28 changes: 28 additions & 0 deletions 12-5-20/Q2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//Q.2 Enumerating GCD
//solving using recursion
#include<stdio.h>
#include<bits/stdc++.h>
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"<<endl;
cin>>A;
cout<<"enter B"<<endl;
cin>>B;
int a=A;
int b=B;

cout<<"The GCD between A and B is :-"<<gcd(a,b)<<" "<<endl;
return 0;
}


Binary file added 12-5-20/Q2.exe
Binary file not shown.
Binary file added 12-5-20/gmon.out
Binary file not shown.
Binary file added 12-5-20/output1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 12-5-20/output2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.