how to print the value of r
DexterDharmawan (0)

int root_finding_1(int n) {
for(int r = 0; r < 10000; r++) {
//hanya tepat jika n mempunyai akar bulat
if (r*r == n)

You are viewing a single comment. View All
abc3354 (110)

Hi :)

You have a multiline if, you should use braces

Replace

if (r*r == n) 
cout <<r;<,endl;
return r; 

By

if (r*r == n) {
    cout << r << endl;
    return r;
} 

(I fixed your cout)


Replit helper here !
If you found my answer helpful, you can upvote it :)