Advertisement
TermSpar

Exponents

Sep 11th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main() {
  5.  
  6.     int num = 10;
  7.     int power = 4;
  8.     int total = 1;
  9.  
  10.     for (int i = 0; i < power; i++) {
  11.         total *= num;
  12.     }
  13.  
  14.     std::cout << num << " raised to the power of " << power << " is " << total << "\n";
  15.  
  16.     system("pause");
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement