int main() { int n, ans = 0; cin >> n; vector <int> f(n); for (int i = 0; i < n; i++) { cin >> f[i]; if (f[i] % 2 == 0) ans++; } cout << ans; return 0; } язык - c++
Привет. Предлагаю тебе такое решение. Так как сам новичок, чуть-чуть попыхтел :)
program dlya_0101000; var a,b,c,d,p,l:integer; m:boolean; label 1,2; begin writeln ('Введите 4 произвольных числа, разделяя их пробелом'); read (a,b,c,d); p:=b*d; if (((b-d) mod 2)= 0) then writeln('Сумма ',(b+d), ' чётная. Два числа и их произведение: ',b*d) else goto 1; m:=(a+c)>150; if m=true then writeln ('Сумма чисел: ',a+c,'. Четыре числа: ',a,' ',b,' ',c,' ',d); if (((b-d) mod 2)<>0) and (m=true) then writeln ('Произведение второго и чётвёртого: ',(b*d), ' .Сумма первого и третьего: ',(a+c)); goto 2; 1: writeln ('Четыре числа: ',a,' ',b,' ',c,' ',d); 2:end.
Type date = record day: 1..31; month: 1..12; year: integer ; end;var a: date := (day: 8; month: 7; year: 2012); b: date := (day: 6; month: 7; year: 2012); c:integer; procedure OutDate(d: date);begin with d do writeln(day, '.', month, '.', year);end;begin if a.year > b.year then c:=1 else c:=-1 ; if a.year = b.year then if a.month > b.month then c:=1 else c:=-1; if a.year = b.year then if a.month = b.month then if a.day > b.day then c:=1 else c:=-1; if a.year = b.year then if a.month = b.month then if a.day = b.day then c:=0; OutDate(a); OutDate(b); writeln('otwet:', c);end.
using namespace std;
int main()
{
int n, ans = 0;
cin >> n;
vector <int> f(n);
for (int i = 0; i < n; i++)
{
cin >> f[i];
if (f[i] % 2 == 0) ans++;
}
cout << ans;
return 0;
}
язык - c++