Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int ft_sum_n_pow(int a, int b, int pow)
  6. {
  7. int sum, ret;
  8.  
  9. sum = a + b;
  10. ret = 1;
  11. while (pow > 0)
  12. {
  13. ret *= sum;
  14. --pow;
  15. }
  16. return (ret);
  17. }
  18.  
  19. int main()
  20. {
  21. int a, b, x;
  22.  
  23. cout << "Please enter value for a, b and x" << endl;
  24. cout << "a = ";
  25. cin >> a;
  26. cout << "b = ";
  27. cin >> b;
  28. cout << "x = ";
  29. cin >> x;
  30. cout << endl << ft_sum_n_pow(a, b, x) << endl;
  31. return (0);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement