Showing posts with label sum and product in delphi. Show all posts
Showing posts with label sum and product in delphi. Show all posts

Wednesday, August 31, 2016

Sum and Product in Delphi

A simple program that I wrote using Delphi as my programming language that will ask the user to give two numbers and then our program will compute the sum and product of the two numbers that is being given by our 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

sum_product.pas

unit sum_product;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    Edit3: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Edit4: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Var a,b : integer;


procedure TForm1.Button1Click(Sender: TObject);
begin
a:= strtoint(edit1.text);
b:= strtoint(edit2.text);
edit3.text := inttostr(a+b);
edit4.text := inttostr(a*b);
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
edit2.text := '';
edit3.text := '';
edit4.text := '';
edit1.setfocus;
end;

end.