Generation

generate functionThu, 04 May 2023

En un programa en C, se teclean 5 precios de artículos distintos que se suman e imprime en pantalla su pago total. Es necesario que se repita este proceso en 5 ocasiones

#include <stdio.h> int main(){ int n = 5, i, j; float precio[n], total=0; for(i=0; i<n; i++){ printf("Ingrese el precio del articulo %d: ", i+1); scanf("%f", &precio[i]); } for(j=0; j<n; j++){ total+=precio[j]; } printf("El total a pagar es: %.2f", total); return 0; }

Want to kickstart your project?Use the new AI Studio to create your code