完成一个Console(控制台程序)打印 1-100 之间的数,如果这个数是3或者5的倍数,就忽略掉?
发布网友
发布时间:2022-05-07 10:35
我来回答
共1个回答
热心网友
时间:2023-10-26 09:47
for I := 1 to 100 do
begin
if (i mod 3 <> 0) and (i mod 5 <>0) then
begin
Writeln('数字:' + IntToStr(i));
end else
begin
if (i mod 3 = 0) and (i mod 5 =0) then
Writeln('数字:' + IntToStr(i)+'是3和5的倍数')
else
if i mod 3 = 0 then
Writeln('数字:' + IntToStr(i)+'是3的倍数')
else
if i mod 5 = 0 then
Writeln('数字:' + IntToStr(i)+'是5的倍数');
end;
end;
热心网友
时间:2023-10-26 09:47
for I := 1 to 100 do
begin
if (i mod 3 <> 0) and (i mod 5 <>0) then
begin
Writeln('数字:' + IntToStr(i));
end else
begin
if (i mod 3 = 0) and (i mod 5 =0) then
Writeln('数字:' + IntToStr(i)+'是3和5的倍数')
else
if i mod 3 = 0 then
Writeln('数字:' + IntToStr(i)+'是3的倍数')
else
if i mod 5 = 0 then
Writeln('数字:' + IntToStr(i)+'是5的倍数');
end;
end;
热心网友
时间:2023-10-26 09:47
for I := 1 to 100 do
begin
if (i mod 3 <> 0) and (i mod 5 <>0) then
begin
Writeln('数字:' + IntToStr(i));
end else
begin
if (i mod 3 = 0) and (i mod 5 =0) then
Writeln('数字:' + IntToStr(i)+'是3和5的倍数')
else
if i mod 3 = 0 then
Writeln('数字:' + IntToStr(i)+'是3的倍数')
else
if i mod 5 = 0 then
Writeln('数字:' + IntToStr(i)+'是5的倍数');
end;
end;