Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace exercicio1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. double peso = double.Parse(n1.Text);
  23. double alt = double.Parse(n2.Text);
  24. double resu = peso/alt;
  25. res.Text = Convert.ToString(resu);
  26. if (resu <= 19)
  27. {
  28. msg.Text = "Abaixo do Peso.";
  29. }else if (resu > 19 && resu <= 25) {
  30. msg.Text = "Peso ideal";
  31. }else if (resu > 25 && resu <= 30) {
  32. msg.Text = "Sobrepeso";
  33. }else if (resu > 30) {
  34. msg.Text = "Muito acima do Peso.";
  35. }
  36. }
  37.  
  38. private void button2_Click(object sender, EventArgs e)
  39. {
  40. msg.Text = "";
  41. res.Text = "";
  42. n1.Text = "";
  43. n2.Text = "";
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement