using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace r_w_property
{
class marksheet
{
private int math;
private int phy;
private int che;
private int eng;
public int math_marks
{
get
{
return math;
}
set
{
math = value;
}
}
public int phy_marks
{
get
{
return phy;
}
set
{
phy = value;
}
}
public int eng_marks
{
get
{
return eng;
}
set
{
eng = value;
}
}
public int che_marks
{
get
{
return che;
}
set
{
che = value;
}
}
}
class Program
{
static void Main(string[] args)
{
marksheet m= new marksheet();
m.math_marks=45;
m.phy_marks=46;
m.che_marks=47;
m.eng_marks=43;
Console.WriteLine
(
@"student individual subject marks:
math marks={0}
phy marks={1}
che marks={2}
eng marks={3} ",m.math_marks,
m.phy_marks,
m.che_marks,
m.eng_marks);
int total = m.math_marks + m.phy_marks + m.che_marks + m.eng_marks;
Console.WriteLine("total marks is:"+total);
float avg = total / 4;
Console.WriteLine("Avrage marks is:"+avg);
Console.ReadKey();
}
}
}
output
student individual subject marks:
math marks=45
phy marks=46
che marks=47
eng marks=43
total marks is:181
Avrage marks is:45
No comments:
Post a Comment