Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- decimal ocena = numericUpDown1.Value;
- listBox1.Items.Add(ocena);
- }
- private void button2_Click(object sender, EventArgs e)
- {
- decimal SumaOcen = listBox1.Items.Count;
- decimal ocenyLepsze = 0, sumaStypendium = 0, procent = 0 ;
- foreach (decimal ocena in listBox1.Items)
- {
- if (ocena >= 4)
- {
- ocenyLepsze += +1;
- sumaStypendium += 50;
- }
- }
- procent = (ocenyLepsze / SumaOcen) * 100;
- procent = Math.Round(procent, 2);
- MessageBox.Show("Burmistrz wyda na stypendium " +sumaStypendium + " zł." + " Procent oceny lepszych od 4 to: " + procent + "%");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement