Thứ Ba, 3 tháng 5, 2022

LOHONG PASCAL

Var    s,n,x:longint;
    a:array[0..9] of longint = (1,0,0,0,1,0,1,0,2,1);
procedure giai;
begin
    s:=0;
    while n>0 do
    begin
        x:=n mod 10;
        s:=s+a[x];
        n:=n div 10;
    end;
    write(s);
end;

Begin
    assign(input, ’lohong.inp’);reset(input);
    assign(output, ’lohong.out’);rewrite(output);
    read(n);
    giai;
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.