Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. decimal ocena = numericUpDown1.Value;
  4. listBox1.Items.Add(ocena);
  5.  
  6. }
  7.  
  8. private void button2_Click(object sender, EventArgs e)
  9. {
  10. decimal SumaOcen = listBox1.Items.Count;
  11. decimal ocenyLepsze = 0, sumaStypendium = 0, procent = 0 ;
  12.  
  13.  
  14. foreach (decimal ocena in listBox1.Items)
  15. {
  16. if (ocena >= 4)
  17. {
  18. ocenyLepsze += +1;
  19. sumaStypendium += 50;
  20. }
  21. }
  22. procent = (ocenyLepsze / SumaOcen) * 100;
  23. procent = Math.Round(procent, 2);
  24. 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