I fixed some of your syntax. I don’t see anything completely wrong with your solution. Maybe the fixed syntax is all you need.
private void button1_Click(object sender, EventArgs e)
{
double hour = (double)numHour.Value;
double minute = (double)numMinute.Value;
if (hour < 12 & rbPM.Checked)
{
hour = hour + 12;
}
else if(hour > 12 & rbAM.Checked)
{
hour = hour - 12;
}
MessageBox.Show(hour.ToString() + ":" + minute.ToString());
}
1
solved how to make program which rotate AM clock to PM and inverse