aaaaaaaaaaaaaaaaa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
public class Program
{
public string name;
public int rollno;
public void setname(string n) //passing here argument to parameter
{ //'n'.
name = n; //passed value assigning to 'name'.
}
public void setrollno(int rn) //passing here in parameter
{ //to 'rn',in function.
rollno = rn; //passed value assigning to 'rollno'.
}
public void showname() //'showname' is function name.
{
Console.WriteLine(name); //used for printing 'name' value.
}
public void showrollno() //'showrollno' is function.
{
Console.WriteLine(rollno); //used for printing 'rollno' value.
}
static void Main(string[] args)
{
Program p = new Program();
p.setname("HiLaLs"); //passing argument'HiLaLs' to parameter
//'n' through function.
p.setrollno(120122067);//passing '120122067' to parameter
//'rn' through function.
p.showname(); //calling 'showname' function.
p.showrollno(); //calling 'showrollno' function.
Console.ReadKey();
}
} //here used 'public string name', and 'public int rollno', there are
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class Program
{
public string name;
public int rollno;
public void set(string n, int rn)
{
name = n;
rollno = rn;
}
public void show()
{ //if U write 'Console.WriteLine(name,rollno);'
//then it not working it printing only 'name'.
//then write like 'Console.WriteLine(name +"\n"+ rollno);', U also write
//without '\n' like 'Console.WriteLine(name +""+ rollno);'.
Console.WriteLine(name);
Console.WriteLine(rollno);
}
static void Main(string[] args)
{
Program p = new Program();
p.set("HiLaLs",120122067);
p.show();
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
public class Program
{
public int length, height;
public void set(int l, int h) //passing here Arguments 5 and 10.
{ //'length' and 'height' is not key word.
length = l;
height = h;
}
public void show()
{ //the formula of Rectangle is 'Length * Height'.
Console.WriteLine(length * height);
} //U also write for printing 'The Rectangle is: 50' write like
//'Console.WriteLine("The Rectangle is: {0}",length * height);'.
static void Main(string[] args)
{
Program p = new Program();
p.set(5, 10); //5 is length and 10 is height, and passing to Parameter 'l' and 'h'.
p.show();
Console.ReadKey();
}
}
}