Showing posts with label swap of numbers in turbo pascal. Show all posts
Showing posts with label swap of numbers in turbo pascal. Show all posts

Thursday, March 30, 2017

Swapping of Two Numbers in Turbo Pascal

In this article I would like to share with you guys a program that I wrote using Turbo Pascal our program will ask the user to give two numbers and then it will swap the arrangement of the two numbers given by our user. The program uses Turbo Pascal for Windows as our Pascal compiler. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output



Program Listing

Program swap_numbers;

Uses WinCrt;

var a,b,temp : integer;

Begin
clrscr;
 writeln;
 Writeln;
 writeln('SWAPPING OF TWO NUMBERS IN PASCAL');
 writeln;
 write('Give first number : ');
 readln(a);
 write('Give second number : ');
 readln(b);
 writeln;
 write('Before Swapping : A = ',a, ' and B = ',b);
 writeln;

  temp := a;
  a:=b;
  b:=temp;

 writeln;
 writeln;
 write('After Swapping : A = ',a, ' and B = ',b);
 writeln;
 Writeln;
 writeln('END OF PROGRAM');
readln;

End.