#include<iostream>
using namespace std;
int perkalian(int n, int a){
int hasil = 0;
for(int i=0; i<a; i++){
hasil = hasil + n;
cout<<hasil<<" + "<<n<<endl;
}
return hasil;
}
int kali (int a,int b){
if(b==1){
return a;
}
return a+kali(a,b-1);
}
int main(){
int x,y;
cout<<"Masukan Nilai x : ";
cin>>x;
cout<<"Masukan Nilai Y : ";
cin>>y;
cout<<"Hasil Perkalian X dan Y : "<<perkalian (x,y);
}
using namespace std;
int perkalian(int n, int a){
int hasil = 0;
for(int i=0; i<a; i++){
hasil = hasil + n;
cout<<hasil<<" + "<<n<<endl;
}
return hasil;
}
int kali (int a,int b){
if(b==1){
return a;
}
return a+kali(a,b-1);
}
int main(){
int x,y;
cout<<"Masukan Nilai x : ";
cin>>x;
cout<<"Masukan Nilai Y : ";
cin>>y;
cout<<"Hasil Perkalian X dan Y : "<<perkalian (x,y);
}
infonya sangat bermanfaat
BalasHapusobeng samsung plus