Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mi proyecto #62

Open
JonathanHuerta27 opened this issue Feb 17, 2024 · 0 comments
Open

Mi proyecto #62

JonathanHuerta27 opened this issue Feb 17, 2024 · 0 comments

Comments

@JonathanHuerta27
Copy link

JonathanHuerta27 commented Feb 17, 2024

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant