/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* Euler_brick.c
* Copyright (C) 2013 drdev
*
* Euler_brick is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Euler_brick is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
/*
Finds sides (a,b,c) of Euler bricks. An Euler brick is a cuboid
whose edges and face diagonals are all integers. This means that
a^2 + b^2 = d^2, a^2 + c^2 = e^2, and b^2 + c^2 = f^2, where a,b,c,d,e,f are
all integers.
*/
#include
#include
#define limit 1000
int a,b,c;
int first,second,third;
double int_part;
float d,e,f;
double sum_sq;
char fn1[12] = "output.txt";
FILE *outdata;
/* prototypes */
void exit(int status);
/* end of prototypes */
int main()
{
if ((outdata = fopen(fn1,"w"))==NULL)
{printf ("\nOutput file cannot be opened.\n");
exit (1);}
//check all a,b for integer d; then a,c for integer e; then b,c for integer f
for(a=1;a