Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
B_141104_TresPuntosTriangulo
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//Title of this code #include <stdio.h> #include <math.h> int main(void) { double x1, x2, x3, y1, y2, y3; double m12, m13; double perimetro; printf("Coordenadas de los puntos ... \n"); printf("x1: "); scanf(" %lf", &x1); printf("y1: "); scanf(" %lf", &y1); printf("x2: "); scanf(" %lf", &x2); printf("y2: "); scanf(" %lf", &y2); printf("x3: "); scanf(" %lf", &x3); printf("y3: "); scanf(" %lf", &y3); if((x1 == x2 && y1 == y2) || (x1 == x3 && y1 == y3) || (x2 == x3 && y2 == y3)) { printf("PUNTOS REPETIDOS. No hay triangulo!\n\n\n"); } else if(x1 == x2 && x1 == x3) { printf("PUNTOS VERTICALES. No hay triangulo!\n\n\n"); } else if(x1 == x2 || x1 == x3 || x2 == x3) { perimetro = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) + sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2)) + sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2)); printf("Perimetro: %lf\n\n", perimetro); } else { m12 = (y2 - y1) / (x2 - x1); m13 = (y3 - y1) / (x3 - x1); if(m12 == m13 || m12 == -m13) { printf("PUNTOS EN LINEA. No hay triangulo!\n\n\n"); } else { perimetro = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) + sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2)) + sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2)); printf("Perimetro: %lf\n\n", perimetro); } } return 0; }
gcc
1.0 2.0 3.0 2.0 4.0 3.0
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 0.13 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0.36 sec
edit mode
|
history
|
discussion
Coordenadas de los puntos ... x1: y1: x2: y2: x3: y3: Perimetro: 6.576491