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 ConsoleApplication9
- {
- class Program
- {
- static void Main(string[] args)
- {
- //numbers:
- int num1, num2, num3;
- //each group:
- double avg = 0, group;
- //total:
- double totalnums = 0, sum = 0;
- //equal:
- double equaltot = 0, equalsum = 0;
- for (int i = 0; i < 100; i++)
- {
- num1 = int.Parse(Console.ReadLine());
- num2 = int.Parse(Console.ReadLine());
- num3 = int.Parse(Console.ReadLine());
- group = num1 + num2 + num3;
- avg = group / 3;
- if (num1 == avg)
- {
- Console.WriteLine("The first number is equal to the avg!");
- }
- else
- {
- Console.WriteLine("The first number is not equal to the avg!");
- }
- Console.WriteLine("avg: " + avg);
- totalnums = totalnums + 3;
- sum = sum + group;
- if (num1 == num2 && num1 == num3)
- {
- equaltot = equaltot + 3;
- equalsum = equalsum + group;
- }
- }
- avg = sum / totalnums;
- Console.WriteLine("The avg of all numbers together is: " + avg);
- avg = equalsum / equaltot;
- Console.WriteLine("The avg of all gorups with all 3 numbers same is: " + avg);
- }
- }
- }
Add Comment
Please, Sign In to add comment