Jagged Array In C#

  1. using System;  
  2. class JaggedTest {  
  3.     static void Main(string[] args) {  
  4.         int[][] jarr = new int[3][];  
  5.         int s = 0;  
  6.         for (int i = 0; i < 3; i++) {  
  7.             Console.WriteLine("Enter the Size of the Array" + (i + 1));  
  8.             int n = Convert.ToInt16(Console.ReadLine());  
  9.             jarr[i] = new int[n];  
  10.             Console.WriteLine("Enter the Values of Array " + (i + 1));  
  11.             for (int j = 0; j < n; j++) {  
  12.                 jarr[i][j] = Convert.ToInt16(Console.ReadLine());  
  13.                 s = s + jarr[i][j];  
  14.             }  
  15.             n = n + 0;  
  16.         }  
  17.         Console.WriteLine("Sum= " + s);  
  18.         Console.ReadKey();  
  19.     }  
  20. }