Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication10
- {
- class Program
- {
- static void Main(string[] args)
- {
- int students = 3, physics = 0, computers = 0, pc = 0;
- double avg, compavg = 0, physavg = 0, pcavg = 0;
- int input;
- for (; students > 0; students--)
- {
- Console.WriteLine("Do you study 'computers' or 'physics'? | 1 for physics, 0 for conputers");
- input = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter your avg: ");
- avg = double.Parse(Console.ReadLine());
- if (input == 0)
- {
- computers++;
- compavg = compavg + avg;
- }
- else
- {
- physics++;
- physavg = physavg + avg;
- }
- if (input == 0 && avg > 80)
- {
- pc++;
- pcavg = pcavg + avg;
- }
- }
- Console.WriteLine("The ammount of students in computer sience class with avg over 80 is " + pc);
- Console.WriteLine("Their avg is: " + (pcavg / pc));
- Console.WriteLine("Physics class student's avg is: " + (physavg / physics));
- Console.WriteLine("Computer sience all student's avg is: " + (compavg / computers));
- if ((compavg / computers) > (physavg / physics))
- {
- Console.WriteLine("Perfect!");
- }
- else
- Console.WriteLine("Fix your grade!");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment