Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int anhanb(int a, int b) {
- if (b==1){
- return a;
- }
- else {
- return a + anhanb(a, b - 1);
- }
- }
- void main(){
- int a, b;
- cout << " nhap a , b: ";
- cin >> a >> b;
- cout <<anhanb(a, b);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement