-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentMarks.cs
57 lines (48 loc) · 1.41 KB
/
StudentMarks.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1._15thdec.Excep
{
class StudentMarks
{
int rollNo;
string name;
float marks;
public void displayAvgMarks(int m)
{
float sum = 0.0f;
for(int i = 0; i < m;i++)
{
sum += m;
}
Console.WriteLine("Average Of Marks=" + (sum / m));
}
static void Main(string[] args)
{
try
{
Console.WriteLine("Enter the Number:");
int roll = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Name:");
string name = Console.ReadLine();
Console.WriteLine("Enter the 5 Subject Marks");
StudentMarks sm = new StudentMarks();
for(int i = 0; i <= 5; i++)
{
sm.marks = int.Parse(Console.ReadLine());
}
}
catch (ArithmeticException)
{
Console.WriteLine("Erroe type is ArrayIndexOutOfBoundsException");
}
catch(Exception)
{
Console.WriteLine("Error message is InputMismatchException");
}
Console.ReadLine();
}
}
}