#include <stdio.h>
#include <math.h>
#include <string.h>
#include <conio.h>
#define N 3
void main ()
{
// описання структури
struct tovar
{
char imya[5];
int kolvo;
int cena1;
float cena2;
int srok;
int obwcena1;
int obwcena2;
}x[N];
int i;
float cenna2;
int maxs,mins,maxc,minc;
float maxc2,minc2;
clrscr();
maxs=0;
mins=0;
maxc=0;
minc=0;
maxc2=0;
minc2=0;
for (i=0;i<N; i++)
{
printf(" imya tovara:\n ");
scanf("%s",&x[i].imya);
printf("\n cena do ycenki:\n ");
scanf("%i",&x[i].cena1);
printf("\n srok hranen:\n ");
scanf("%i",&x[i].srok);
}
fflush(stdin);
for(i=0;i<N;i++){
if(x[i].srok>2)
cenna2=x[i].cena1/2;
x[i].cena2=cenna2;
printf("------------------\n");
printf("imya tovara - %s\n cena do ycenki - %i\n cena posle ycenki - %7.2f \n, srok hraneniya %i\n",x[i].imya,x[i].cena1,cenna2,x[i].srok);
}
for(i=0;i<N;i++)
if(maxs<x[i].srok){maxs=x[i].srok; }
if(mins>x[i].srok){mins=x[i].srok; }
printf("maximalnui srok = %i \n",maxs);
printf("minimalnui srok = %i \n",mins);
if(maxc<x[i].cena1){maxc=x[i].cena1; }
if(minc>x[i].cena1){minc=x[i].cena1; }
printf("maximalna cena do ycenki = %i \n",maxc);
printf("minimalna cena do ycenki = %i \n",minc);
if(maxc2<cenna2){maxc2=cenna2; }
if(minc2>cenna2){minc2=cenna2; }
printf("maximalna cena pislia ycenki = %f \n",maxc2);
printf("minimalna cena pislia ycenki = %f \n",minc2);
getch();
}