Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Loops1100
- {
- class Program
- {
- static void Main(string[] args)
- {
- //1.Read a numbers n
- int n = int.Parse(Console.ReadLine());
- double leftSum = 0;
- double rightSum = 0;
- for (int i = 1; i <= n; i++)
- {
- leftSum = leftSum + int.Parse(Console.ReadLine());
- }
- if (leftSum == rightSum)
- {
- Console.WriteLine($"Yes, sum = " + leftSum);
- }
- else
- {
- double diffrence = Math.Abs(rightSum - leftSum);
- Console.WriteLine($"No, diff = " + diffrence);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment