Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program szablon13;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- n,i,a,suma,max,min,liczba:integer;
- srednia:real;
- spr:char;
- begin
- repeat
- writeln('Ile liczb chcesz podac? n>0'); readln(n);
- suma:=0;
- if n <= 0 then
- begin
- writeln('nie spelniono warunku');
- readln;
- end
- else
- begin
- for i:=1 to n do
- begin
- writeln('Podaj liczbe ',i,':');
- readln(a);
- if i=1 then
- begin
- max:=a;
- end;
- suma:=suma+a;
- srednia:=(srednia+a)/n;
- if max < a then
- begin
- max:=a;
- end
- else
- min:=a;
- end;
- Writeln('Menu:');
- Writeln('1) zobaczyc sume');
- Writeln('2) zobaczyc srednia');
- Writeln('3) zobaczyc max i min');
- Writeln('Co robimy?: ');readln(liczba);
- case liczba of
- 1:writeln('Suma wynosi: ',suma);
- 2:writeln('Srednia wynosi: ',srednia:2:3);
- 3:writeln('Max: ',max,' Min: ',min);
- end;
- end ;
- writeln;
- writeln('Raz jeszcze? t/n?: ');readln(spr);
- until spr = 'n';
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement