#include <stdio.h>
int main() {
// Declaración de variables
long codigo_articulo;
float precio_unitario, cantidad_articulos;
float porcentaje_descuento;
float precio_total, valor_descuento, valor_iva, precio_final;
printf("=== PUNTO DE VENTA - TIENDAS RAZA ===\n\n");
// 1. Solicitar los datos por teclado
printf("Ingrese el codigo del articulo (maximo 6 cifras): ");
scanf("%ld", &codigo_articulo);
printf("Ingrese el precio en euros (E): ");
scanf("%f", &precio_unitario);
printf("Ingrese la cantidad de articulos: ");
scanf("%f", &cantidad_articulos);
printf("Ingrese el descuento a aplicar en tanto por ciento (ej. 10 para 10%%): ");
scanf("%f", &porcentaje_descuento);
// 2. Realizar los cálculos comerciales
// Precio total bruto = cantidad * precio unitario (ej. 3 * 15.50 = 46.50)
precio_total = cantidad_articulos * precio_unitario;
// Descuento sobre el precio total (ej. 46.50 * 10 / 100 = 4.65)
valor_descuento = precio_total * (porcentaje_descuento / 100.0);
// 16% de IVA calculado sobre el precio total sin descuento (ej. 46.50 * 0.16 = 7.44)
valor_iva = precio_total * 0.16;
// Precio final TOTAL = (Precio Total - Descuento) + IVA (ej. (46.50 - 4.65) + 7.44 = 49.29)
precio_final = (precio_total - valor_descuento) + valor_iva;
// 3. Mostrar el ticket con el formato exacto requerido
printf("\n\n");
printf(" ---- RAZA ----\n");
printf("%-15ld %.2f€\n", codigo_articulo, precio_unitario);
printf("%.0f %.2f€\n", cantidad_articulos, precio_total);
printf("-%.0f%% -%.2f€\n", porcentaje_descuento, valor_descuento);
printf("16%% IVA +%.2f€\n", valor_iva);
printf("TOTAL %.2f€\n", precio_final);
printf("Kevin Toala");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: