Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- double firstNumber = double.Parse(Console.ReadLine());
- double max = firstNumber;
- double counter = max;
- for (int i = 0; i < n-1; i++)
- {
- double number = double.Parse(Console.ReadLine());
- counter += number;
- if (number > max)
- {
- max = number;
- }
- //else
- // {
- // counter += number;
- // }
- }
- counter -= max;
- if (max == counter)
- {
- Console.WriteLine("Yes, sum = {0}", max);
- }
- else
- {
- Console.WriteLine("No, diff = {0}", Math.Abs(counter - max));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement