本程序设计界面如下图所示: procedure TForm1.Button1Click(Sender: TObject); //“计算”按钮 var i , n, sum : integer ; begin sum := 0 ; i := 1 ; n := StrToInt(edit1.Text); //读入正整数n while i <=n do //循环语句 begin if odd( i ) then sum :=sum+i; i := i +1 ; end; edit2.Text :=IntToStr( sum ); //将结果在编辑框中显示 end; 用户在edit1中输入一个正整数7,则在edit2中显示计算结果为: A、7 B、14 C、16 D、21