Algorithm a to power b by while? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Algorithm a to power b by while?

7th Nov 2019, 7:37 AM
‎سهراب روزبه‎
‎سهراب روزبه‎ - avatar
4 Answers
+ 4
Isn't a**b working? You could do it with while while(a<a**b){ a++; } cout << a; (Idk if this will work) (I see you started C++ course, so I suppose you want the answer in C++)
7th Nov 2019, 7:54 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 6
In what language?
7th Nov 2019, 7:54 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
what language are you using? If you're using python: i=0 num=a while i<b: a*=num i+=1 If you're using c++: int i=1; int num=a; while(i<b){ a*=num; i+=1; }
7th Nov 2019, 7:55 AM
ΛM!N
ΛM!N - avatar
+ 1
c++ thank you
7th Nov 2019, 11:36 AM
‎سهراب روزبه‎
‎سهراب روزبه‎ - avatar