- 1
Write a program that uses a while loop to determine the smallest integer power of 3 that exceeds 30 000.
In other words find the smallest value of n so that 3^n>30000.
4 Answers
+ 3
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n = sqrt(30000);
cout << ++n << endl;
return 0;
}
+ 3
@Burey is right: even if it's non-efficient to do that way, that's what was asking ;P
+ 1
a solution using a while loop as requested
https://code.sololearn.com/cE8U21PeS0V1/?ref=app