Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C_141105_PuntosTriangulo
#include <stdio.h> #include <math.h> int main(void) { double x1, x2, x3, y1, y2, y3; // Coordenadas de los tres puntos double m12, m13; // Pendientes double perimetro; // Perimetro del triangulo printf("Entrada de Coordenadas...\n"); printf("Coordenada punto 1:\n"); printf("\tx1: "); scanf(" %lf", &x1); printf("\ty1: "); scanf(" %lf", &y1); printf("Coordenada punto 2:\n"); printf("\tx2: "); scanf(" %lf", &x2); printf("\ty2: "); scanf(" %lf", &y2); printf("Coordenada punto 3:\n"); printf("\tx3: "); scanf(" %lf", &x3); printf("\ty3: "); scanf(" %lf", &y3); if((x1 == x2 && y1 == y2) || (x1 == x3 && y1 == y3) || (x2 == x3 && y2 == y3)) { printf("Puntos repetidos.\n"); } if(x1 == x2 && x1 == x3) { printf("Puntos Verticales. No hay triangulo.\n"); } else if(x1 == x2 || x1 == x3 || x2 == x3) { perimetro = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)) + sqrt(pow(x1 - x3, 2) + pow(y1 - y3, 2)) + sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2)); printf("Perimetro: %lf\n", perimetro); } else { m12 = (y1 - y2) / (x1 - x2); m13 = (y1 - y3) / (x1 - x3); if(m12 == m13 || m12 == -m13) { printf("Puntos en Linea. No hay triangulo.\n"); } else { perimetro = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)) + sqrt(pow(x1 - x3, 2) + pow(y1 - y3, 2)) + sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2)); printf("Perimetro: %lf\n", perimetro); } } return 0; }
run
|
edit
|
history
|
help
0
QuickSort
Pointer
150116_PrimoFactorial
Project 4 v0.1
1/30
Project 5 v0.11
StructSurvey
709 lab 3.1
22nd HW Switchv1.0
assignment5