En el codigo hay varias sentencias q estan de mas pq las hice para armar la funcion q tendria q descartar los repetidos, las dejo para q vean lo q trataba de hacer, pero si se le sacan el codigo anda igual..
Código
#include<stdio.h> #include<math.h> #define LIMITE 500 int compara_vector(double vec[], double num, int indice); main() { int i, j, k, m = 1; double lado1 = (double)1, lado2 = (double)1, hipotenusa = (double)1; double num, rtdoH, rtdoLs, rtdoM[LIMITE*2]; for (i = 1; i <= LIMITE; i++){ lado2 = 1; for ( j = 1; j <= LIMITE; j++){ hipotenusa = 1; for (k = 1; k <= LIMITE; k++){ rtdoM[m] = lado1 * lado2 * hipotenusa; if (rtdoH == rtdoLs){ num = rtdoM[m]; if((compara_vector(rtdoM, num, m)) == 0) m++; } hipotenusa++; } lado2++; } lado1++; } return 0; } int compara_vector(double vec[], double num, int indice) { int i; for(i = indice; i >= 0; i--){ if(vec[i] != num){ return 0; } } }
Bueno espero sugerencias!!