Thứ Sáu, 8 tháng 7, 2022

TONGCS PASCAL

var n,s,x: longint;
begin
    assign(input, 'tongcs.inp');reset(fi);
    assign(output, 'tongcs.out');rewrite(fo);
    read(n);
    s:=0;
    while n>0 do
    begin
        x:=n mod 10;
        s:=s+x;
        n:=n div 10;
    end;
    write(s);
end.

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.