💻 Hacer un programa que muestre el área y perímetro de un paralelogramo.
ÁREA DEL PARALELOGRAMO : ÁREA = B * h
PERÍMETRO DEL PARALELOGRAMO : PERÍMETRO = 2 x (b + h)
Área de un paralelogramo :
Perímetro de un paralelogramo :
Algoritmo programacion_work
// Área y Perímetro de un Paralelogramo
Definir P, A, b, h como Real;
Escribir "ÁREA DEL PARALELOGRAMO";
Escribir Sin Saltar "BASE : ";
Leer b;
Escribir Sin Saltar "ALTURA : ";
Leer h;
A <- b * h;
Escribir "ÁREA : ",A, " cm²";
Escribir "";
Escribir "PERÍMETRO DEL PARALELOGRAMO";
P <- (2 * h) + (2 * b);
Escribir "PERÍMETRO : ",P, " cm";
FinAlgoritmo
print("24. ÁREA Y PERÍMETRO DEL PARALELOGRAMO.")
import math
print("ÁREA DEL PARALELOGRAMO")
b = float(input("BASE : "))
h = float(input("ALTURA : "))
A = (b * h)
print("ÁREA : ", round(A,2), "cm2")
print()
print("PERÍMETRO DEL PARALELOGRAMO")
P = (2 * h) + (2 * b)
print("PERÍMETRO : ",round(P,2), "cm")
#include<stdio.h>
int main() {
float b, h, A=0, P=0;
printf("24. AREA Y PERIMETRO DEL PARALELOGRAMO.\n\n");
printf("Ingrese Base : ");
scanf("%f",&b);
printf("Ingrese Altura : ");
scanf("%f",&h);
A = b * h;
P = (2 * h) + (2 * b);
printf("\nAREA : %.2f cm. \n",A);
printf("PERIMETRO : %.2f cm. \n", P);
return 0;
}
#include<iostream>
using namespace std;
int main() {
float b, h, A=0, P=0;
cout << "24. AREA Y PERIMETRO DEL PARALELOGRAMO.\n\n";
cout << "Ingrese Base : ";
cin >> b;
cout << "Ingrese Altura : ";
cin >> h;
A = b * h;
P = (2 * h) + (2 * b);
cout << "\nAREA : " << A << " cm." << endl;
cout << "PERIMETRO : " << P << " cm." << endl;
return 0;
}
using System;
using System.Collections.Generic;
using System.Text;
namespace programacion_work
{
class paralelogramo
{
static void Main(string[] args)
{
double b, h, A = 0, P = 0;
Console.WriteLine("24. AREA Y PERIMETRO DEL PARALELOGRAMO EN C#.\n");
Console.Write("Ingrese Base : ");
b = double.Parse(Console.ReadLine());
Console.Write("Ingrese Altura : ");
h = double.Parse(Console.ReadLine());
A = b * h;
P = (2 * h) + (2 * b);
Console.WriteLine("\nAREA : " + String.Format("{0,4:##.00}", A));
Console.WriteLine("PERIMETRO : " + String.Format("{0,4:##.00}", P));
Console.ReadLine();
}
}
}
package programacion_work;
import java.util.Scanner;
public class paralelogramo {
public static void main(String[] args) {
Scanner ingreso=new Scanner(System.in);
double P, A, b, h;
System.out.print("24. PARALELOGRAMO - 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;
P = (2 * h) + (2 * b);
System.out.println("");
System.out.println("ÁREA : " + A + " cm.");
System.out.println("PERÍMETRO : " + P + " cm.");
}
}
private void jBtn_CalcularActionPerformed(java.awt.event.ActionEvent evt) {
double A, b, h;
b = Double.parseDouble(jTxt_Base.getText());
h = Double.parseDouble(jTxt_Altura.getText());
A = b * h;
DecimalFormat df = new DecimalFormat("#.00");
jTxt_Area.setText(df.format(A));
}
private void jBtn_Calcular1ActionPerformed(java.awt.event.ActionEvent evt) {
double P, b, h;
b = Double.parseDouble(jTxt_Base1.getText());
h = Double.parseDouble(jTxt_Altura1.getText());
P = (2 * h) + (2 * b);
DecimalFormat df = new DecimalFormat("#.00");
jTxt_Perimetro.setText(df.format(P));
}
Imports System.Console
Module trapecio
Dim P, A, b, h As Decimal
Sub Main()
WriteLine("24. MOSTRAR EL ÁREA Y PERÍMETRO DE UN PARALELOGRAMO.")
WriteLine("")
Write("Ingrese Base : ")
b = ReadLine()
Write("Ingrese Altura : ")
h = ReadLine()
A = b * h
P = (2 * h) + (2 * b)
WriteLine("")
WriteLine("ÁREA : " & A)
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 A, b, h As Decimal
b = Txt_Base.Text
h = Txt_Altura.Text
A = b * h
Txt_Area.Text = A
End Sub
Private Sub Btn_Calcular1_Click(sender As Object, e As EventArgs) Handles Btn_Calcular1.Click
Dim P, b, h As Decimal
b = Txt_Base1.Text
h = Txt_Altura1.Text
P = (2 * h) + (2 * b)
Txt_Perimetro.Text = P
End Sub
Sub Area_Trapecio()
Dim B As Double
Dim Bb As Double
Dim h As Double
B = Range("C15").Value
Bb = Range("D15").Value
h = Range("E15").Value
Range("H15").Value = ((B * Bb) * h) / 2
End Sub
Sub Perimetro_Trapecio()
Dim l1 As Double
Dim l2 As Double
Dim l3 As Double
Dim l4 As Double
l1 = Range("C18").Value
l2 = Range("D18").Value
l3 = Range("E18").Value
l4 = Range("F18").Value
Range("H18").Value = l1 + l2 + l3 + l4
End Sub
Sub Area_Trapecio2()
Dim B As Double
Dim Bb As Double
Dim h As Double
B = InputBox("INGRESE BASE MAYOR ")
Bb = InputBox("INGRESE BASE MENOR ")
h = InputBox("INGRESE ALTURA ")
MsgBox "Área del Trapecio : " & ((B * Bb) * h) / 2
End Sub
Sub Perimetro_Trapecio2()
Dim l1 As Double
Dim l2 As Double
Dim l3 As Double
Dim l4 As Double
l1 = InputBox("LADO 01 ")
l2 = InputBox("LADO 02 ")
l3 = InputBox("LADO 03 ")
l4 = InputBox("LADO 04 ")
MsgBox "Perímetro del Círculo : " & l1 + l2 + l3 + l4
End Sub
Dim B As Double
Dim Bb As Double
Dim h As Double
Dim l1 As Double
Dim l2 As Double
Dim l3 As Double
Dim l4 As Double
Private Sub btn_area_Click()
B = txt_BaseMa.Text
Bb = txt_BaseMe.Text
h = txt_Altura.Text
txt_area.Text = ((B * Bb) * h) / 2
End Sub
Private Sub btn_perimetro_Click()
l1 = txt_l1.Text
l2 = txt_l2.Text
l3 = txt_l3.Text
l4 = txt_l4.Text
txt_perimetro.Text = l1 + l2 + l3 + l4
End Sub