后n-1位数 用pascal
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/07/22 08:25:36
后n-1位数 用pascal
试题描述
已知w是一个位数不大于1000的无符号整数,若w是n(n≥2)位的整数,则求出w的后n-1位的数.
输入
输入中包括一个无符号整数w.
输出
w对应的n-1位数(忽略前缀0).如果除了最高位外,其余位都为0,则输出0.
输入示例
1234
输出示例
234
试题描述
已知w是一个位数不大于1000的无符号整数,若w是n(n≥2)位的整数,则求出w的后n-1位的数.
输入
输入中包括一个无符号整数w.
输出
w对应的n-1位数(忽略前缀0).如果除了最高位外,其余位都为0,则输出0.
输入示例
1234
输出示例
234
![后n-1位数 用pascal](/uploads/image/z/18557424-0-4.jpg?t=%E5%90%8En-1%E4%BD%8D%E6%95%B0+%E7%94%A8pascal)
var c:char; out:boolean;
begin
c:=' ';
while not (c in ['1'..'9']) do read(c);
repeat read(c) until c'0';
if c in ['0'..'9'] then out:=true;
repeat write(c); read(c) until not (c in ['0'..'9']);
if not out then write(0);
writeln
end.
begin
c:=' ';
while not (c in ['1'..'9']) do read(c);
repeat read(c) until c'0';
if c in ['0'..'9'] then out:=true;
repeat write(c); read(c) until not (c in ['0'..'9']);
if not out then write(0);
writeln
end.