12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Filimonova_exam
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnAnsw_Click(object sender, EventArgs e)
- {
- int k = Convert.ToInt32(textA.Text); // для расчёта % пятёрок
- int m = Convert.ToInt32(textB.Text); // для расчёта % четвёрок
- int n = Convert.ToInt32(textC.Text); // для расчёта % троек
- int N = Convert.ToInt32(textN.Text); // общее количество студентов
- double p = (double)k/N * 100; //расчёт процента для 5
- double f = (double)n/N * 100; //расчёт процента для 4
- double h = (double)m/N * 100; //расчёт процента для 3
- double A = Math.Round(p,2);
- double B = Math.Round(f,2);
- double C = Math.Round(h,2);
- textAnswer1.Text = $"Процент троек = {C}";
- textAnswer2.Text = $"Процент четвёрок = {B}";
- textAnswer3.Text = $"Процент пятёрок = {A}";
- }
- }
- }
|