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 exercicio1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- double peso = double.Parse(n1.Text);
- double alt = double.Parse(n2.Text);
- double resu = peso/alt;
- res.Text = Convert.ToString(resu);
- if (resu <= 19)
- {
- msg.Text = "Abaixo do Peso.";
- }else if (resu > 19 && resu <= 25) {
- msg.Text = "Peso ideal";
- }else if (resu > 25 && resu <= 30) {
- msg.Text = "Sobrepeso";
- }else if (resu > 30) {
- msg.Text = "Muito acima do Peso.";
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- msg.Text = "";
- res.Text = "";
- n1.Text = "";
- n2.Text = "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement