7
Answers

Beginner need help

Josip Pavic

Josip Pavic

13y
3.3k
1
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)
Next Recommended Forum