---
title: "example of jagged array of storing student rollno and marks"  
description: "in this example use the jagged for storing student rollno and marks."  
author: "Ravi Vishwakarma"  
published: 2021-07-05  
canonical: https://www.mindstick.com/articles/327219/example-of-jagged-array-of-storing-student-rollno-and-marks  
category: "c#"  
tags: ["c#", "array"]  
reading_time: 3 minutes  

---

# example of jagged array of storing student rollno and marks

using [System](https://yourviews.mindstick.com/view/81211/democracy-is-the-system-for-handling-healthcare-crisis);\

[class](https://yourviews.mindstick.com/story/1320/facts-about-the-white-house-you-missed-in-history-class) HelloWorld

{

[static void](https://www.mindstick.com/interview/2715/can-we-write-static-public-void-instead-of-public-static-void) Main ()

{

[string](https://www.mindstick.com/articles/1817/objective-c-strings)[][]student_detail = new string[2][];

for ([int](https://www.mindstick.com/forum/34185/how-to-use-like-clause-is-it-possible-to-use-it-with-int-data-type-variable) i = 0; i < student_detail.Length; i++)\

{

student_detail[i] = new string[6];

//Console.WriteLine('[student](https://yourviews.mindstick.com/view/84686/importance-of-brahmacharya-in-student-life) '+student_detail[i].GetLength(0));

}

for (int i = 0; i < student_detail.Length; i++)\

{

Console.WriteLine ('Enter ' + (i + 1) + ' student roll no :');

student_detail[i][0] = Console.ReadLine ();

for (int j = 1; j < student_detail[i].GetLength (0); j++)

{

Console.WriteLine ('Enter ' + j + ' marks of ' + (i + 1) +

' student :');

student_detail[i][j] = Console.ReadLine ();

}

}

Console.WriteLine ('Roll No \t Marks \n');\

for (int i = 0; i < student_detail.Length; i++)\

{

Console.Write (student_detail[i][0] + '\t');

for (int j = 1; j < student_detail[i].GetLength (0); j++)

{

Console.Write (student_detail[i][j] + ' ');

}

Console.WriteLine ('');

}

Console.WriteLine('If you want to [search](https://answers.mindstick.com/qa/102660/what-considerations-matter-when-using-google-s-dataset-search-for-research) marks of student then press for yes = 'y' or no = 'n' ');\

string yes_no = Console.ReadLine ();

while (yes_no.Equals ('y'))\

{

bool exist_val=false;

Console.WriteLine('Enter student rollno :');

string search = Console.ReadLine ();

for (int i = 0; i < student_detail.Length; i++)

{

if(search.Equals(student_detail[i][0]))

{

Console.Write ('\tMarks \t');

for (int j = 1; j < student_detail[i].GetLength (0); j++)

{

Console.Write (student_detail[i][j] + ' ');

}

Console.WriteLine ('');

exist_val=[true](https://yourviews.mindstick.com/view/84985/yoga-can-transform-our-lives-true-2023-view);

break;

}else{

exist_val=false;

}

}

if(!exist_val)

Console.WriteLine('this student roll no doesn't exits ..... ');

Console.WriteLine('If you want to search marks of student then press for yes = 'y' or no = 'n' ');\

yes_no = Console.ReadLine ();

}

Console.WriteLine ('\n\nThanks for using....');\

}\

}

\

[Output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) -

Enter 1 student roll no :

123

Enter 1 marks of 1 student :

45

Enter 2 marks of 1 student :

56

Enter 3 marks of 1 student :

58

Enter 4 marks of 1 student :

75

Enter 5 marks of 1 student :

59

Enter 2 student roll no :

124

Enter 1 marks of 2 student :

45

Enter 2 marks of 2 student :

78

Enter 3 marks of 2 student :

95

Enter 4 marks of 2 student :

[6n56

Enter 5 marks of 2 student :

78

Roll No Marks

123 45 56 58 75 59

124 45 78 95 56 78

If you want to search marks of student then press for yes = 'y' or no = 'n'

y

Enter student rollno :

125

this student roll no doesn't exits .....

If you want to search marks of student then press for yes = 'y' or no = 'n'

y

Enter student rollno :

123

Marks 45 56 58 75 59

If you want to search marks of student then press for yes = 'y' or no = 'n'

y

Enter student rollno :

124

Marks 45 78 95 56 78

If you want to search marks of student then press for yes = 'y' or no = 'n'

y

Enter student rollno :

125

this student roll no doesn't exits .....

If you want to search marks of student then press for yes = 'y' or no = 'n'

n

Thanks for using....

\

\

---

Original Source: https://www.mindstick.com/articles/327219/example-of-jagged-array-of-storing-student-rollno-and-marks

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
