Question #13975

Write an application that will accept two decimal values in textboxes and calculate the sum and the quotient.When button Calculate1 is clicked • The two numbers are stored in variables • Call one method Calculate to perform calculations • Display results on labels Methods.Method Calculator uses call-by-value and call-by-reference(Ref) parameters to return thevalues.

Expert's answer

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Quotient

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void btnCalculate_Click(object sender, EventArgs e)

{

int result;

int sum;

sum=int.Parse(txtFirst.Text)+int.Parse(txtSecond.Text);

int quotient = Math.DivRem(int.Parse(txtFirst.Text), int.Parse(txtSecond.Text), out

result);

lblResult.Text ="Quotient= "+quotient.ToString() + " " + result.ToString() + " Sum= " + sum.ToString();

}

}

}

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Quotient

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void btnCalculate_Click(object sender, EventArgs e)

{

int result;

int sum;

sum=int.Parse(txtFirst.Text)+int.Parse(txtSecond.Text);

int quotient = Math.DivRem(int.Parse(txtFirst.Text), int.Parse(txtSecond.Text), out

result);

lblResult.Text ="Quotient= "+quotient.ToString() + " " + result.ToString() + " Sum= " + sum.ToString();

}

}

}

## Comments

## Leave a comment