Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void pythagoras(int n){
- int a,b,c;
- for(c = 1; c < n; ++c){
- for(b = 1; b < n; ++b){
- for(a = 1; a < n; ++a){
- if ( pow(a,2) + pow(b,2) == pow(c,2) ){
- printf("pythagorean triple %d, %d , %d \n", a,b,c);
- }
- }
- }
- }
- }
- int main(){
- int n;
- printf("enter a integer \n");
- scanf("%d", &n);
- pythagoras(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement