Pascal: var n,sum:integer; begin sum:=0; write ('N = '); readln (n); while n <> 0 do begin sum:=sum+(n mod 10); n:=n div 10; end; if sum = 10 then writeln ('YES') else writeln ('NO'); end.
C++: #include <iostream> using namespace std;
int main() { int n,sum = 0; cout <<"N = "; cin >>n; while (n!=0) { sum+=n%10; n/=10; } if (sum==10) cout <<"YES" <<endl; else cout <<"NO" <<endl; return 0; }
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку