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

Saturday, August 27, 2016

Average of Three Numbers in Turbo Pascal

A simple program that will ask the user to give three numbers and then our program will compute the average of the three numbers being provided by the user.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.
  



Sample Program Output


Program Listing

Program average_three_numbers;
Uses WinCrt;

Var
  Choice : Char;
  num1,num2,num3 : Integer;
  Average : Real;

Begin
  Clrscr;
  Choice := 'Y';
  Write('Average of Three Numbers in Turbo Pascal');
  Writeln;
  Writeln;
  While upcase(Choice) = 'Y' Do
    Begin
     Writeln;
     Write('Enter three numbers : ');
     Readln(num1,num2,num3);
     Average := (num1+num2+num3)/3;
     Writeln;
     Write('The Average is ' ,Average:8:2,'.');
     Writeln;
     Writeln;
     Write('Continue [Y/N] : ');
     readln(choice);
     Writeln;
    End;
    Writeln;
    Write('End of Program');
    Writeln;
  Readln;
End.