how to find the power of a number without using function,in | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to find the power of a number without using function,in

11th May 2017, 7:35 AM
Edrees Noori
Edrees Noori - avatar
2 Answers
+ 10
int num; int res = 1; int power; cin >> num; cin >> power; for (int i = 0; i < power; i++) { res *= num; } cout << res;
11th May 2017, 7:38 AM
Hatsy Rei
Hatsy Rei - avatar
0
thanks so much
11th May 2017, 7:55 AM
Edrees Noori
Edrees Noori - avatar