Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Perfection
Language: PASCAL
Code:
program Sample;
var 
  num1,num2,i,sum,temp:integer;
Begin
 Repeat
  write('Enter the first integer: ');
  readln(num1);
  write('Enter the second integer: ');
  readln(num2);
 Until num1<>num2;
 If num1>=num2 Then
begin
  temp:=num1;
  num1:=num2;
  num2:=temp;
end;
  sum:=0;
 For i:=num1 TO num2 Do
  sum:=sum+i;
          writeln(num1,'+',num1+1,'+','...','+',num2,'=',sum);
  readln
End.

          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
Comments: