-
Notifications
You must be signed in to change notification settings - Fork 0
/
class and objeccts marks.cs
91 lines (74 loc) · 2.35 KB
/
class and objeccts marks.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication99
{
class Program
{
class twelve
{
public string name;
public int roll_no;
public string section;
public void printbase()
{
Console.WriteLine("Name "+name);
Console.WriteLine("Roll_no "+roll_no);
Console.WriteLine("Section "+section);
}
}
class result : twelve
{
public string[] subjects = new string[4] { "1.sdt", "2.sfc", "3.ddw", "4.cs" };
public int[] marks = new int[4];
public void printing()
{
int count;
count = 0;
while(count<subjects.Length)
{
Console.WriteLine(subjects[count]);
count++;
}
count = 0;
while(count<subjects.Length)
{
Console.WriteLine("enter the marks for the given subject "+(count+1));
marks[count] = int.Parse(Console.ReadLine());
count++;
}
count = 0;
int total;
total = 0;
int percentage;
while(count<marks.Length)
{
total = total + marks[count];
count++;
}
percentage = total / 4;
Console.WriteLine("\n Student got "+percentage+"%");
}
}
static void Main(string[] args)
{
result absek = new result();
absek.name = "absek";
absek.roll_no = 14;
absek.section = "A";
absek.printbase();
absek.printing();
Console.WriteLine();
Console.WriteLine();
result asis = new result();
asis.name = "asis";
asis.roll_no = 1;
asis.section = "A";
asis.printbase();
asis.printing();
Console.ReadKey();
}
}
}