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 ConsoleApp20
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int allSum = 0;
- int biggestNum = 0;
- for (int i = 0; i < n; i++)
- {
- int readNum = int.Parse(Console.ReadLine());
- allSum += readNum;
- if (biggestNum < readNum)
- {
- biggestNum = readNum;
- }
- }
- if (allSum - biggestNum == biggestNum)
- {
- Console.WriteLine($"Yes Sum = {biggestNum}");
- }
- else if (biggestNum < allSum)
- {
- Console.WriteLine($"No Diff = {Math.Abs(allSum - biggestNum - biggestNum)}");
- }
- else
- {
- Console.WriteLine($"No Diff = {biggestNum}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment