program p1; var n,m,s:real; i:integer; a:array[1..7] of real; begin write('Write n: '); readln(n); write('Write m: '); readln(m); writeln('Enter the weight of things: '); for i:=1 to 7 do read(a[i]);
s:=0; for i:=1 to 6 do s:=s+a[i]; if s>20 then begin s:=(s-20)*n; writeln('For luggage: ',s:0:2); end else writeln('For luggage: ',s:0:2);
if a[7]>5 then begin a[7]:=(a[7]-5)*m; writeln('For hand luggage: ',a[7]:0:2); end else writeln('For hand luggage: ',a[7]:0:2); readln end.
#define N 7 #define M 3 #include <iostream> using namespace std; int main() { float Y[N][M]; // Ввод данных for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) cin >> Y[i][j];
float sum = 0, prod = 0; for (int i = 0; i < N; i++) { prod = 1; for (int j = 0; j < M; j++) { prod *= Y[i][j]; } sum += prod; } cout << "Sum: " << sum << ".\n"; return 0; }