ALGORITMO QUE MUESTRA EL TOTAL DE LAS COMPRAS

Categoría de Estructura Repetitiva Mientras


Calcule el total a pagar por sus compras en PSeInt

💻 Hacer un programa dónde se ingrese la cantidad y el precio de N compras, hasta que el cliente indique que NO desea más pedidos, al finalizar se debe de mostrar el monto total de todas las compras, el IGV y el total a pagar incluido del IGV.


Algoritmo en pseint que calcule el total a pagar PSeInt Estricto : DESCARGA EL CÓDIGO

Algoritmo en pseint de youtube short VER EL CÓDIGO
Algoritmo programacion_work
    Definir cant como Entero;
    Definir monto_compra, precio, IGV, total como Real;
    Definir continua como Caracter;
    total <- 0;
    continua <- "S";
    Mientras continua <> "N" Hacer
        Escribir Sin Saltar "CANTIDAD : ";
        Leer cant;
        Escribir Sin Saltar "PRECIO : $ ";
        Leer precio;
        monto_compra <- cant * precio;
        total <- total + monto_compra;
        Escribir Sin Saltar "¿OTRA COMPRA (S/N)? ";
        Leer continua;
        Escribir "";
    FinMientras
    IGV <- total * 0.18;
    Escribir "TOTAL DE COMPRA : $.", total;
    Escribir "IGV 18% (IVA) : $.", IGV;
    Escribir "TOTAL A PAGAR : $.", total+IGV;
FinAlgoritmo

código en python que muestra el total a pagar Python :

continua = "S"
total=0
while continua != "N":
    cant = int(input("CANTIDAD : "))
    precio = float(input("PRECIO : $ "))
    monto_compra = cant * precio;
    total += monto_compra
    continua = input("¿OTRA COMPRA [S/N]? : ")
IGV = total * 0.18
print("TOTAL DE COMRA : $.", total)
print("IGV 18% o IVA  : $.", IGV)
print("TOTAL A PAGAR  : $.",(total+IGV))   

código en LENGUAJE C que calcula el total a pagar LENGUAJE C :

#include<stdio.h>
#include<string.h>
#define MAX_STRLEN 256
int main() {
    int cant;  
    float monto_compra=0.0, precio, IGV=0.0, total=0.0;	
    char continua[MAX_STRLEN];
    while( strcmp(continua, "N") != 0 ){
        printf("CANTIDAD : ");
        scanf("%d",&cant);
        printf("PRECIO   : $.");
        scanf("%f",&precio);
        monto_compra = cant * precio;
        total = total + monto_compra;
        IGV = total * 0.18;	    
        printf("OTRA COMPRA [S/N]? : ");
        scanf("%s",continua);
    }
    IGV = total * 0.18;
    printf("\nTOTAL DE COMPRA  : $.%.2f", total );
    printf("\nIGV 18 PORCIENTO : $.%.2f", IGV );
    printf("\nTOTAL A PAGAR    : $.%.2f", (total + IGV) ); 	    	
    return 0;
}

código en Dev C++ que muestra el total a pagar por N compras Dev C++ :

#include<iostream>
using namespace std;
int main() {
    int cant=0;  
    double monto_compra=0, precio=0, IGV=0, total=0;
    string continua="S";
    while( continua != "N"){
        cout << "CANTIDAD : ";
        cin >> cant;
        cout << "PRECIO : $.";
        cin >> precio;
        monto_compra = cant * precio;
        total += monto_compra;
        cout << "¿OTRA COMPRA [S/N]? : ";
        cin >> continua;
        continua = toupper(continua[0]);
    }
    cout << endl;
    IGV = total * 0.18;
    cout << "TOTAL DE COMPRA  : $." << total << endl;
    cout << "IGV 18 PORCIENTO : $." << IGV << endl;
    cout << "TOTAL A PAGAR    : $." << (total + IGV) << endl;	
    return 0;
}



Facebook de www.programacion.work. Canal de Youtube de www.programacion.work. Twitter de www.programacion.work. TikTok de www.programacion.work.


Política de cookies

Política de Privacidad

Aviso Legal y Términos De Uso