Tuesday, April 18, 2017

Positive and Negative Numbers in Turbo Pascal

Here is a sample program that will ask the user to give a number and then our program will determine and check if the given number is a positive or a negative number using Turbo Pascal the code is very short and easy to understand. 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 negative_positive_number;

Uses Crt;

Var Num : Integer;

Begin
  Clrscr;
  Num := 0;
  writeln;
  Writeln;
  Write('Negative and Positive Number in Turbo Pascal');
  writeln;
  Writeln;
  Write('Enter a Number : ');
  Readln(Num);

  if (num>=0) then 
  Begin
      Writeln;
      Write('Your given number ' ,num, ' is a POSITIVE NUMBER.');
      Writeln;
  End
     Else 
     Begin
      Writeln;
      Write('Your given number ' ,num, ' is a NEGATIVE NUMBER.');
      Writeln;
  End;

  Writeln;
  Write('End of Program');
  Writeln;
  Readln;

end.

No comments:

Post a Comment