把以下C程序改成delhpi程序
来源:百度知道 编辑:UC知道 时间:2024/05/15 15:12:47
#include<stdio.h>
void main()
{
int i,n;
n=0;i=0;
printf("input start:");
scanf("%d",&i);
//printf("start:%d\n",i);
while(n<100)
{
if((i++)%3)
{
printf("%d\t",i-1);
n++;
if(n%10==0)printf("\n");
}
}
getchar();
}
void main()
{
int i,n;
n=0;i=0;
printf("input start:");
scanf("%d",&i);
//printf("start:%d\n",i);
while(n<100)
{
if((i++)%3)
{
printf("%d\t",i-1);
n++;
if(n%10==0)printf("\n");
}
}
getchar();
}
已测试以下Delphi程序和楼主提供的C程序算法一致,输出相同
program ProjectUnname;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
i, n: integer;
s: string;
begin
n := 0;
WriteLn('Input Start:');
ReadLn(s);
i := StrToIntDef(s, 1);
while n < 100 do
begin
Inc(i);
if (i - 1) mod 3 <> 0 then
begin
Write(IntToStr(i - 1) + #9);
Inc(n);
if n mod 10 = 0 then
WriteLn;
end;
end;
ReadLn;
end.
program p1;
{$APPTYPE CONSOLE}
uses