💻 Hacer un programa que muestre el área y perímetro de un triángulo.
ÁREA DEL TRIÁNGULO : A = (b * h) / 2; (Base por altura entre dos)
PERÍMETRO TRIÁNGULO EQUILÁTERO : P = L * 3; (La suma de cada uno de sus lados)
🔹 CALCULAR EL ÁREA Y PERÍMETRO DEL TRIÁNGULO
🔹 MOSTRAR SI LOS LADOS FORMAN UN TRIÁNGULO
🔹 MUESTRA LA BASE Y ALTURA DE UN TRIÁNGULO
🔹 MUESTRA GRÁFICA DE NÚMEROS EN FORMA DE TRIÁNGULO
🔹 MUESTRA EL TRIÁNGULO DE PASCAL
🔹 DIBUJAR UN TRIÁNGULO EQUILÁTERO DE ASTERÍSCOS
• Perímetro de un triángulo equilátero.
PERÍMETRO (Triángulo Equilátero) = 3 . L
PERÍMETRO (Triángulo Isósceles) = (2 . L) + b
PERÍMETRO (Triángulo Escaleno) = L1 + L2 + L3
Algoritmo programacion_work
Definir P, L, A, b, h como Real;
Escribir "ÁREA DEL TRIÁNGULO";
Escribir Sin Saltar "BASE : ";
Leer b;
Escribir Sin Saltar "ALTURA : ";
Leer h;
A <- (b * h) / 2;
Escribir "ÁREA : ",A,"cm.";
Escribir "";
Escribir "PERÍMETRO DEL TRIÁNGULO EQUILÁTERO";
Escribir Sin Saltar "LADO : ";
Leer L;
P <- L * 3;
Escribir "PERÍMETRO : ",P,"cm.";
FinAlgoritmo
print("16. ÁREA Y PERÍMETRO DEL TRIÁNGULO.")
print("ÁREA DEL TRIÁNGULO")
b = int(input("INGRESE BASE : "))
h = int(input("INGRESE ALTURA : "))
A = (b*h)/2
print("ÁREA : ", A)
print()
print("PERÍMETRO DE UN TRÍANGULO EQUILÁTERO")
l = int(input("INGRESE LADO : "))
P = l*3
print("PERÍMETRO : ",P)
#include<stdio.h>
int main() {
float b, h, l, A=0, P=0;
printf("16. AREA Y PERIMETRO DEL TRIANGULO\n\n");
printf("Ingrese Base : ");
scanf("%f",&b);
printf("Ingrese Altura : ");
scanf("%f",&h);
A = (b * h)/2;
printf("AREA : %.2f cm. \n",A);
printf("\nIngrese Lado : ");
scanf("%f",&l);
P = l * 3;
printf("PERIMETRO : %.2f cm. \n", P);
return 0;
}
#include<iostream>
using namespace std;
int main() {
float b, h, l, A=0, P=0;
cout << "16. AREA Y PERIMETRO DEL TRIANGULO.\n\n";
cout << "Ingrese Base : ";
cin >> b;
cout << "Ingrese Altura : ";
cin >> h;
A = (b * h)/2;
cout << "AREA : " << A << "cm." << endl;
cout << "\nIngrese Lado : ";
cin >> l;
P = l * 3;
cout << "PERIMETRO : " << P << "cm." << endl;
return 0;
}
using System;
using System.Collections.Generic;
using System.Text;
namespace programacion_work
{
class triangulo
{
static void Main(string[] args)
{
double b, h, l, A = 0, P = 0;
Console.WriteLine("16. AREA Y PERIMETRO DEL TRIANGULO EN C#.\n");
Console.Write("Ingrese Base : ");
b = double.Parse(Console.ReadLine());
Console.Write("Ingrese Altura : ");
h = double.Parse(Console.ReadLine());
A = (b * h) / 2;
Console.WriteLine("AREA : " + String.Format("{0,4:##.00}", A));
Console.Write("\nIngrese Lado : ");
l = double.Parse(Console.ReadLine());
P = l * 3;
Console.WriteLine("PERIMETRO : " + String.Format("{0,4:##.00}", P));
Console.ReadLine();
}
}
}
package programacion_work;
import java.util.Scanner;
public class triangulo {
public static void main(String[] args) {
Scanner ingreso=new Scanner(System.in);
double b, h, A=0, P=0, L;
System.out.print("16. TRIÁNGULO - Mostrar el área y perímetro.\n\n");
System.out.print("INGRESE BASE : ");
b = Double.parseDouble(ingreso.next());
System.out.print("INGRESE ALTURA : ");
h = Double.parseDouble(ingreso.next());
A = (b*h)/2;
System.out.println("ÁREA : " + A + " cm.");
System.out.println("");
System.out.print("INGRESE LADO : ");
L = Double.parseDouble(ingreso.next());
P = L * 3;
System.out.println("PERÍMETRO : " + P + " cm.");
}
}
private void jBtn_CalcularActionPerformed(java.awt.event.ActionEvent evt) {
double b, h, A=0;
b = Double.parseDouble(jTxt_Base.getText());
h = Double.parseDouble(jTxt_Altura.getText());
A = (b*h)/2;
jTxt_Area.setText(String.valueOf(A));
}
private void jBtn_Calcular1ActionPerformed(java.awt.event.ActionEvent evt) {
double P=0, L;
L = Double.parseDouble(jTxt_Lado.getText());
P = L * 3;
jTxt_Perimetro.setText(String.valueOf(P));
}
Imports System.Console
Module triangulo
Dim b, h, l, A, P As Decimal
Sub Main()
WriteLine("16. MOSTRAR EL ÁREA Y PERÍMETRO DE UN TRIÁNGULO.")
WriteLine("")
Write("Ingrese Base : ")
b = ReadLine()
Write("Ingrese Altura : ")
h = ReadLine()
A = (b * h) / 2
WriteLine("ÁREA : " & A)
WriteLine("")
Write("Ingrese Lado : ")
l = ReadLine()
P = l * 3
WriteLine("PERÍMETRO : " & P)
ReadLine()
End Sub
End Module
Private Sub Btn_Calcular_Click(sender As Object, e As EventArgs) Handles Btn_Calcular.Click
Dim b, h, A As Decimal
b = Txt_Base.Text
h = Txt_Altura.Text
A = (b * h) / 2
Txt_Area.Text = A
End Sub
Private Sub Btn_Calcular1_Click(sender As Object, e As EventArgs) Handles Btn_Calcular1.Click
Dim l, P As Decimal
l = Txt_Lado.Text
P = l * 3
Txt_Perimetro.Text = P
End Sub
Sub Area_Triangulo()
Dim b As Double
Dim h As Double
b = Range("C15").Value
h = Range("D15").Value
Range("G15").Value = (b * h) / 2
End Sub
Sub Perimetro_Triangulo()
Dim l As Double
l = Range("D18").Value
Range("G18").Value = l * 3
End Sub
Sub Area_Triangulo2()
Dim b As Double
Dim h As Double
b = InputBox("INGRESE BASE")
h = InputBox("INGRESE ALTURA")
MsgBox "Área del Triángulo : " & ((b * h) / 2)
End Sub
Sub Perimetro_Triangulo2()
Dim l As Double
l = InputBox("INGRESE ALTURA")
MsgBox "Perímetro del Triángulo : " & (l * 3)
End Sub
Dim b As Double
Dim h As Double
Dim l As Double
Private Sub btn_area_Click()
b = txt_base.Text
h = txt_altura.Text
txt_area.Text = (b * h) / 2
End Sub
Private Sub btn_perimetro_Click()
l = txt_lado.Text
txt_perimetro.Text = l * 3
End Sub