Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Diagonal Difference
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 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 n = Convert.ToInt32(Console.ReadLine()); int[][] a = new int[n][]; for(int a_i = 0; a_i < n; a_i++){ string[] a_temp = Console.ReadLine().Split(' '); a[a_i] = Array.ConvertAll(a_temp,Int32.Parse); } int primaryD = 0; int secD = 0; for(int i=0; i<n; i++){ int j= n-i-1; primaryD +=a[i][i]; secD +=a[i][j]; } int result = Math.Abs((primaryD - secD)); Console.WriteLine(result); } } }
run
|
edit
|
history
|
help
0
EDFCSCSA V
RankingNumeric
sfdcsddxasdxsd
Pets Name Generator
Project Euler Problem 7
Compare list
Examples of JS-Like higher-order functions in C#
Compiler
switch it
dfgthytgrfedcf