Last active
December 14, 2015 21:19
-
-
Save tuankiet65/5150015 to your computer and use it in GitHub Desktop.
Nhập vào một số nguyên dương n. tính tổng của các chữ số là số nguyên tố của n.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program bt2; | |
uses crt; | |
var n: int64; | |
tong, nchr: longint; | |
begin | |
clrscr; | |
write('Nhap n: '); | |
readln(n); | |
while n<>0 do begin | |
nchr:=n mod 10; | |
if nchr in [2, 3, 5, 7] then tong:=tong+nchr; | |
n:=n div 10; | |
end; x | |
write('Tong: ', tong); | |
readkey; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment