← Back to Analisis Kode
Prev

Question 4 — Hitung

Analisis Kode · 20 points · Answer key: 5120

Next

Question

#include <iostream>
using namespace std;
int hitung(int x, int y) {
    if (x + y <= 0) return 0;
    if (x >= 0) return hitung(x - 1, y * 2);
    return hitung(x - 1, y - 1) + 1;
}
int main() {
    cout << hitung(10, 5) << endl;
    return 0;
}

Jawab: …………………………………………………… {tuliskan output program}

Answers (7 members)

MemberAnswer
Yazid5120
Algazel5120
Athmar5120
Habibie6084
Kian2561
Athar10240
Priscilla-