Class consist of
methods and variables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class
Program
{
class
student
{
int
rno;
string
name, address;
public
void getdata(int
r, string n, string
add)
{
rno = r;
name = n;
address = add;
}
public
void display()
{
Console.WriteLine("ROLL
NUMBER: "+rno.ToString());
Console.WriteLine("Name:
" + name);
Console.WriteLine("Address:
" + address);
}
}
static
void Main(string[]
args)
{
student
sd = new student();
Console.WriteLine("enter no,name,address");
sd.getdata(int.Parse(Console.ReadLine()),
Console.ReadLine(), Console.ReadLine());
sd.display();
Console.WriteLine("end");
Console.ReadLine();
}
}
}
No comments:
Post a Comment