Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Half Sum
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here int num = Convert.ToInt32(Console.ReadLine()); int[] sequence1 = new int[num]; int[] sequence2 = new int[num]; for (int i = 0; i<num; i++) { sequence1[i] = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i<num; i++) { sequence2[i] = Convert.ToInt32(Console.ReadLine()); } //calculates sums int result1 = 0; int result2 = 0; foreach (int number in sequence1) { //Console.WriteLine(number); result1 = result1 + number; //Console.WriteLine(result1); } //Console.WriteLine(result1); foreach (int number in sequence2) { // Console.WriteLine(number); result2 = result2 + number; } //Console.WriteLine(result2); if (result1 == result2) { Console.WriteLine("Yes, sum={0}", result1); } else { Console.WriteLine("No, diff={0}", Math.Abs(result1 - result2)); } } } }
run
|
edit
|
history
|
help
0
Inheritance Gone Wrong Template
base interior 0.1
factorial ncr
JagArray
save bitmap from stream problem
Validate or get the check digit of a Windows activation installation ID / confirmation ID
The modifier 'private' is not valid for this item
abebe
Fórum ➡ GroupJoin'ing Books and Orders ( with Zip'ped output ) ♦
ArithmeticOperations