<u><em>Pascal:</em></u>
var n,a,s:longint;
begin
repeat
write ('N = ');
readln(n);
until n in [10..99];
write ('A = ');
readln(a);
s:=0;
while n<>0 do
begin
s:=s+n mod 10;
n:=n div 10;
end;
if s>a then writeln ('YES') else writeln ('NO');
readln;
end.
<em><u>C++:</u></em>
#include <iostream>
using namespace std;
int main()
{
int a,n,s = 0;
do
{
cout <<"N = ";
cin >>n;
}
while (n<10 || n>99);
cout <<"A = ";
cin >>a;
while (n!=0)
{
s+=n\%10;
n/=10;
}
if (s>a)
cout <<"YES" <<endl;
else cout <<"NO" <<endl;
return 0;
}
Чтобы длина кода была минимальной и допускалось условие, нужно дать код "01" для буквы Г.
Ответ: 3) 01
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
setlocale(LC_ALL,"Russian");
cin >> n;
if ( n > 0 )
cout << "Положительное\n";
else
cout << "Отрицательное\n";
n = abs(n);
int ans = 0;
while (n)
{
n /= 10;
ans++;
}
cout << ans << " цифр\n";
}
PascalABC.net
var x,y:real;
begin
write('Введите x: ');
readln(x);
if (x>=-2) and (x<=-1) then y:=2*x+4;
if (x>-1) and (x<=1) then y:=2*x*x;
if (x>1) and (x<=2) then y:=-2*x+2;
if (x<-2) or (x>2) then
writeln('Функция не определена')
else writeln('f(x)=',y);
<span>end.</span>
Григорий-строитель,Алексей-водитель,Вениаин-программист,Борис-аптекарь