-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Asesor 2
#include <stdio.h>
#include <conio.h>
struct datos
{
int codigo;
int cantidad;
float precio;
};
struct datos Regi[10];
main()
{
int i;
int nelems = 10;
float importe = 0.0;
printf("< Solicitud de ingreso de del seguro : %d >\n", nelems);
for(i = 0; i < nelems; i++)
{
printf("\nnro. elemento: %d\n", i+1);
printf("ingrese código: ");
scanf("%d", &Regi[i].codigo);
printf("ingrese meses a contratar: ");
scanf("%d", &Regi[i].cantidad);
printf("ingrese precio: ");
scanf("%f", &Regi[i].precio);
}
puts("\n< Resultados >\n");
printf("Código");
for(i = 0; i < nelems; i++)
{
printf(" %d", Regi[i].codigo);
}
printf("\nCantidad");
for(i = 0; i < nelems; i++)
{
printf(" %d", Regi[i].cantidad);
}
printf("\nPrecio");
for(i = 0; i < nelems; i++)
{
printf(" %.2f", Regi[i].precio);
}
printf("\nImporte");
for(i = 0; i < nelems; i++)
{
printf(" %.2f", (Regi[i].cantidad * Regi[i].precio));
}
getch();
return 0;