Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- double A, P, r, n, t;
- try
- {
- P = Double.Parse(textBox1.Text);
- r = Double.Parse(textBox2.Text);
- n = Double.Parse(textBox3.Text);
- t = Double.Parse(textBox4.Text);
- if (P < 0&&n<0&&t<0&&r<0)
- {
- MessageBox.Show("Грешка");
- textBox1.Clear();
- textBox2.Clear();
- textBox3.Clear();
- textBox4.Clear();
- textBox5.Clear();
- }
- if (radioButton1.Checked)
- {
- A = P * Math.Pow((1 + r / n), n * t );
- textBox1.Text = P.ToString();
- textBox2.Text = r.ToString();
- textBox3.Text = n.ToString();
- textBox4.Text = t.ToString();
- textBox5.Text = A.ToString();
- }
- else
- {
- if (radioButton2.Checked)
- {
- A = Double.Parse(textBox5.Text);
- A = P * (1 + r * t);
- textBox1.Text = P.ToString();
- textBox2.Text = r.ToString();
- textBox3.Text = n.ToString();
- textBox4.Text = t.ToString();
- textBox5.Text = A.ToString();
- }
- }
- }
- catch
- {
- MessageBox.Show("Въведете коректни стойности");
- textBox1.Clear();
- textBox2.Clear();
- textBox3.Clear();
- textBox4.Clear();
- textBox5.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement