program count6; uses crt; {-------------------------------------------------------------------------- This program will ask the user for 2 numbers, then ask what increment to count by, then it will count from the first number to the second. by --------------------------------------------------------------------------} VAR a,x,y,i,sum:integer; begin clrscr; write ('Hello! Type in a number. ---> '); readln (x); writeln; write ('Very good. Now type another number, larger than the first ---> '); readln (y); writeln; write ('What increment do you want to count by? ---> '); readln (i); writeln; writeln; textcolor (green); a := 0; sum := x; while x <= y do begin a := a + 1; writeln ('Number ',a,' is ',x); x := x + i; if x <= y then sum := sum + x; end; writeln; writeln; writeln ('The sum of all those numbers is ',sum,'!!'); if x - i <> y then writeln ('Because of the increment you entered in, you didn''t hit the last number exactly.'); readln; end.