Advertisement
wheatles

blatt4aufg4

Nov 17th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void pythagoras(int n){
  5. int a,b,c;
  6.  
  7. for(c = 1; c < n; ++c){
  8. for(b = 1; b < n; ++b){
  9. for(a = 1; a < n; ++a){
  10. if ( pow(a,2) + pow(b,2) == pow(c,2) ){
  11. printf("pythagorean triple %d, %d , %d \n", a,b,c);
  12. }
  13. }
  14. }
  15. }
  16. }
  17.  
  18. int main(){
  19. int n;
  20.  
  21. printf("enter a integer \n");
  22. scanf("%d", &n);
  23.  
  24. pythagoras(n);
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement