Var a: array[1..100] of integer; i,k,sum,n: integer; begin writeln('введите количество элементов массива'); read(n); k: =0; sum: =0; writeln('введите элементы массива'); for i: =1 to n do begin read(a[i]); if (a[i] mod 4 =0) and (a[i] mod 10 =4) then begin k: =k+1; sum: =sum+a[i]; end; end; writeln('количество элементов = ',k,' сумма элементов = ',sum); end.
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct river{
string name;
double length;
double depth;
bool ships;
};
signed main(){
int n;
cin >> n;
river a[n];
for(int i = 0; i < n; i++)
cin >> a[i].name >> a[i].length >> a[i].depth >> a[i].ships;
vector<river> ans;
for(auto i: a)
if(i.length > 2 && i.ships)
ans.push_back(i);
for(auto i: ans){
cout << "name: " << i.name << "\n";
cout << "length: " << i.length << "\n";
cout << "depth: " << i.depth << "\n";
cout << "ships?: Yes";
}
}