Sunday, February 14, 2016

Odd and Even Number Checker in Pascal

A simple program that I wrote using Pascal as my programming language that will ask the user to give a  number and then our program will determine if the given number by the user is ODD or EVEN number. The program itself is very short and easy to understand. I am using Turbo Pascal 6 as my compiler in writing this program.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

Program Odd_Even_Number;
Uses Crt;

Var Number : Integer;
    R     : Integer;
    Ch    : Char;

Begin
  Clrscr;
  Repeat
  Writeln;
  Number := 0;
  R := 0;
  Writeln('Odd and Even Number Checker in Pascal');
  Writeln;
  Writeln;
  Write('Enter a Number : ');
  Readln(Number);

  R := Number MOD 2;

     If (R=0) Then
       Begin
         Writeln(Number ,' is a Even Number. ');
         Writeln;
       End
     Else
       Begin
         Writeln(Number,' is Odd Number. ');
         Writeln;
       End;
    Writeln;
    Write(' Do you want to continue y/n ?');
    Ch := Upcase(readkey);
    Until Ch = 'N';
    Writeln;
    Writeln;
    Write('Thank You For Using This Software.');
    Readln;                                  
 End.



No comments:

Post a Comment