Josip Pavic

Josip Pavic

  • NA
  • 20
  • 10.8k

Beginner need help

Nov 11 2011 7:07 AM
Can you tell me what is wrong with this IF statement??
I think I mix something with operators.

namespace exercise1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
int age;

age = int.Parse(textBox1.Text);

if (age < 17)
{
MessageBox.Show("You're still a youngster.");
}
if (age <= 25)
{
MessageBox.Show("Fame beckons!");
}
if (age <= 40)
{
MessageBox.Show("There's still time.");
}
if (age > 40)
{
MessageBox.Show("Oh dear, you've probably missed it!");
}

}
}
}


Thanks for help!!!

Answers (7)