fabbe680

2.1

Jan 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // Laboration 2, Assignment_1.cpp
  2. // Fabian Tjernström (fatj1700) 2018-11-20
  3.  
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.  
  10. int a, b , c;
  11. int total = 0;
  12.  
  13. for( a = 1; a <= 500; a++ ) {
  14. for ( b = 1; b <= 500; b++ ) {
  15. for ( c = 1; c <= 500; c++ ) {
  16. if ( (a * a) + (b * b) == (c * c) && c <= 500 ) {
  17. total++;
  18. }
  19. }
  20. }
  21. }
  22.  
  23. cout << total << endl;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment