who learn the C#.net this programs are helpful to Understand C#.net better.
Simple Programs For New Learners
programs |
1. Write a console program to print welcome message?
class Program
{
static void Main(string[] args)
{
{
Console.WriteLine("Welcome to C#.Net");
Console.ReadLine();
}
}
}
OUTPUT:Welcome to C#.Net
*****Technical C#.net Questions*****
2. Write a console program to print 3 welcome messages?
class Program
{
static void Main(string[] args)
{
{
Console.WriteLine("Welcome to C#.Net");
Console.WriteLine("Welcome to ASP.Net");
Console.WriteLine("Welcome to ADO.Net");
Console.WriteLine("Welcome to ASP.Net");
Console.WriteLine("Welcome to ADO.Net");
Console.ReadLine();
}
}
}
OUTPUT:Welcome to C#.Net
Welcome to ASP.Net
Welcome to ADO.Net
*****Technical C#.net Questions*****
3. Write a console program to print one string value and one numerical value?
class Program
{
static void Main(string[] args)
{
{
Console.WriteLine("Rahul");
Console.WriteLine(25);
Console.ReadLine();
}
}
}
OUTPUT: Rahul
25
*****Technical C#.net Questions*****
4.Write a console program to declare one string value and one numerical value?
class Program
{
static void Main(string[] args)
{
string name="Rahul";
byte age=25;
{
string name="Rahul";
byte age=25;
Console.WriteLine(name);
Console.WriteLine(age);
Console.ReadLine();
}
}
}
OUTPUT: Rahul
25
*****Technical C#.net Questions*****
5.Example to display variable values with userdefined strings?
class Program
{
static void Main(string[] args)
{
string name="Rahul";
byte age=25;
{
string name="Rahul";
byte age=25;
Console.WriteLine("Your Name is:"+name);
Console.WriteLine("Your Age is:"+age);
Console.ReadLine();
}
}
}
OUTPUT: Your Name is: Rahul
Your Age is: 25
*****Technical C#.net Questions*****
6. Write a console program to display employee info i.e., employee no, employee name, employee salary?
class Program
{
static void Main(string[] args)
{
employee no=123;
employee name="Ganesh";
employee salary=25000;
{
employee no=123;
employee name="Ganesh";
employee salary=25000;
Console.WriteLine("Employee No is:"+no);
Console.WriteLine("Employee Name is:"+name);
Console.WriteLine("Employee Salary is:"+age);
Console.ReadLine();
}
}
}
OUTPUT:Employee No is: 123
Employee Name is: Ganesh
Employee Salary is: 25000
*****Technical C#.net Questions*****
7. Write a console program to store student marks,They are m1,m2,m3.Calculate total marks and average marks and finally display?
class Program
{
static void Main(string[] args)
{
int m1=60;
int m2=70;
int m3=80;
int totmar=m1+m2+m3;
int avgmar=totmar/3;
Console.WriteLine("Student total marks are:"+totmar);
{
int m1=60;
int m2=70;
int m3=80;
int totmar=m1+m2+m3;
int avgmar=totmar/3;
Console.WriteLine("Student total marks are:"+totmar);
Console.WriteLine("St);udent average marks are:"+avgmar);
Console.ReadLine();
0 comments:
Post a Comment