- 6 İŞLEM YAPABILEN HESAP MAKINESI ( TOPLAMA, CIKARMA ,BOLME ,CARPMA,UST ALMA VE KOK BULMA ) -
C#
ALT PROGRAMLA (VOID) YAPILMIS HESAP MAKINESI KODLARIDIR...
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 WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } void topla() { int a, b, c; a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a + b; MessageBox.Show(c.ToString()); } void çıkar() { int a, b, c; a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a - b; MessageBox.Show(c.ToString()); }
void çarp() { int a, b, c; a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a * b; MessageBox.Show(c.ToString()); }
void böl() { int a, b, c; a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); c = a / b; MessageBox.Show(c.ToString()); }
void ust() { int a, b, c=1,i; a = Convert.ToInt16(textBox1.Text); b = Convert.ToInt16(textBox2.Text); for (i = 0; i < b; i++)
c = c * a; MessageBox.Show(c.ToString()); } void kök() { int a,b; a = Convert.ToInt16(textBox1.Text); b = a; textBox2.Text=(Math.Sqrt(a).ToString()); }