c# .net | namespace and class with constructor | code source | program | output | comments
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace constatnt
{
class Program // class name program
{
int i;
float j;
public Program(int x, float z) // constructor declared as public
{
i = x;
j = z;
}
public void display()
{
Console.Write("roll number"+i+"\n"+"salary ="+j+"rs");
}
static void Main(string[] args ) // main of the program
{
Program p = new Program(10, 3.4f);
p.display();
}
}
}
/*output
//program c# .net | namespace and class with constructor | code source | program | output | comments//
roll number =10
salary =3.4 rs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace constatnt
{
class Program // class name program
{
int i;
float j;
public Program(int x, float z) // constructor declared as public
{
i = x;
j = z;
}
public void display()
{
Console.Write("roll number"+i+"\n"+"salary ="+j+"rs");
}
static void Main(string[] args ) // main of the program
{
Program p = new Program(10, 3.4f);
p.display();
}
}
}
/*output
//program c# .net | namespace and class with constructor | code source | program | output | comments//
roll number =10
salary =3.4 rs
0 comments: