Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laboration 2, Assignment_1.cpp
- // Fabian Tjernström (fatj1700) 2018-11-20
- #include <iostream>
- using namespace std;
- int main() {
- int a, b , c;
- int total = 0;
- for( a = 1; a <= 500; a++ ) {
- for ( b = 1; b <= 500; b++ ) {
- for ( c = 1; c <= 500; c++ ) {
- if ( (a * a) + (b * b) == (c * c) && c <= 500 ) {
- total++;
- }
- }
- }
- }
- cout << total << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment