Skip to content

Mi proyecto #62

Description

@JonathanHuerta27

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions