dot net

 Q1:Write a Menu driven program in C# to perform following functionality:  Addition, Multiplication, Subtraction, Division.   */

using System;

usingSystem.Collections.Generic;

namespace Program

{

classProgram

    {

staticvoid Main(string[] args)

        {

int Num1, Num2, result, option;

 

Console.Write("Enter the First Number : ");

            Num1 = int.Parse(Console.ReadLine());

Console.Write("Enter the Second Number : ");

            Num2 = int.Parse(Console.ReadLine());

Console.WriteLine("Main Menu");

Console.WriteLine("1. Addition");

Console.WriteLine("2. Subtraction");

Console.WriteLine("3. Multiplication");

Console.WriteLine("4. Division");

Console.Write("Enter the Operation you want to perform : ");

option = int.Parse(Console.ReadLine());

switch (option)

            {

case 1:

result = Num1 + Num2;

Console.WriteLine("The result of Addition is : {0}", result);

break;

case 2:

result = Num1 - Num2;

Console.WriteLine("The result of Subtraction is : {0}", result);

break;

case 3:

result = Num1 * Num2;

Console.WriteLine("The result of Multiplication is : {0}", result);

break;

case 4:

result = Num1 / Num2;

Console.WriteLine("The result of Division is : {0}", result);

break;

default:

Console.WriteLine("Invalid Option");

break;

            }

Console.ReadLine();

        }

 

    }

}

 Q2:Write a C# Program to Accept the Height of a Person & Categorize as Tall, Dwarf or Average

using System;

classprogram

{

publicstaticvoid Main()

    {

float height;

Console.WriteLine("Enter  the Height (in centimeters) \n");

height = float.Parse(Console.ReadLine());

if (height < 150.0)

Console.WriteLine("Dwarf \n");

elseif ((height >= 150.0) && (height <= 165.0))

Console.WriteLine(" Average Height \n");

elseif ((height >= 165.0) && (height <= 195.0))

Console.WriteLine("Taller \n");

else

Console.WriteLine("Abnormal height \n");

    }

}

Q1: Write a windows application inc# to display selected item in list box and use Selection mode ‘One’ to select one item at a time.

namespace WinFormsApp20

{

publicpartialclassForm1 : Form

    {

publicForm1()

        {

InitializeComponent();

        }

 

privatevoid Form1_Load(object sender, EventArgs e)

        {

listBox1.Items.Add("Sunday");

listBox1.Items.Add("Monday");

listBox1.Items.Add("Tuesday");

listBox1.Items.Add("Wednesday");

listBox1.Items.Add("Thursday");

listBox1.Items.Add("Friday");

listBox1.Items.Add("Saturday");

            listBox1.SelectionMode = SelectionMode.One;

 

        }

 

privatevoid button1_Click(object sender, EventArgs e)

        {

foreach (objectobjin listBox1.SelectedItems)

            {

MessageBox.Show(obj.ToString());

            }

 

        }

    }

}

 Q3:Write a C# Program to Generate the Marksheet of the Student take Roll Number, studentsname,marks of three subject and calculate percentage and print Grade according to percentage.

 */

using System;

usingSystem.Collections.Generic;

 

namespace Marksheet1

{

classProgram

    {

staticvoid Main(string[] args)

        {

int r, m1, m2, m3, t;

float p;

string n;

Console.WriteLine("Enter Roll Number :");

            r = int.Parse(Console.ReadLine());

Console.WriteLine("Enter Student Name :");

            n = Console.ReadLine();

Console.WriteLine("Mark of Subject1 : ");

            m1 = int.Parse(Console.ReadLine());

Console.WriteLine("Mark of Subject2 : ");

            m2 = int.Parse(Console.ReadLine());

Console.WriteLine("Mark of Subject3 : ");

            m3 = int.Parse(Console.ReadLine());

            t = m1 + m2 + m3;

            p = t / 3;

Console.WriteLine("Total : " + t);

Console.WriteLine("Percentage : " + p);

if (p >= 35 && p < 50)

            {

Console.WriteLine("Grade is C");

            }

if (p >= 50 && p <= 60)

            {

Console.WriteLine("Grade is B");

            }

if (p > 60 && p <= 80)

            {

Console.WriteLine("Grade is A");

            }

if (p > 80 && p <= 100)

            {

Console.WriteLine("Grade is A+");

            }

Console.ReadLine();

        }

    }

}

1.       Write a C#.Net Program to define a class Person having members –name, address. Create a subclass called employee with member staffed, salary. Create ‘n’ objects of the Employee class and display all the details of the Employee.

using System;

 

classPerson

{

publicstring Name;

publicstring Address;

}

 

classEmployee : Person

{

publicintStaffId;

publicfloat Salary;

}

 

classProgram

{

staticvoid Main()

    {

Console.Write("Enter the number of employees (n): ");

int n = int.Parse(Console.ReadLine());

 

// Create an array of Employee objects

Employee[] employees = new Employee[n];

 

// Accept details for each employee

for (inti = 0; i< n; i++)

        {

employees[i] = new Employee();

 

Console.WriteLine("\nEnter details for Employee {0}:\n",i + 1);

 

Console.Write("Enter Name: ");

employees[i].Name = Console.ReadLine();

 

Console.Write("Enter Address: ");

employees[i].Address = Console.ReadLine();

 

Console.Write("Enter Staff ID: ");

employees[i].StaffId = int.Parse(Console.ReadLine());

 

Console.Write("Enter Salary: ");

employees[i].Salary = float.Parse(Console.ReadLine());

        }

 

// Display details for each employee

Console.WriteLine("\nEmployee Details:\n");

for (inti = 0; i< n; i++)

        {

Console.WriteLine("Employee {0}:\n", i + 1);

Console.WriteLine("Name: {0}", employees[i].Name);

Console.WriteLine("Address: {0}", employees[i].Address);

Console.WriteLine("Staff ID: {0}", employees[i].StaffId);

Console.WriteLine("Salary: {0}\n", employees[i].Salary);

        }

    }

}

Q4: Write a C# Program to Perform Matrix Multiplication

 */

using System;



namespace matrix_multiplication

{

    class Program

    {

        static void Main(string[] args)

        {

            int i, j, m, n;

            Console.WriteLine("Enter the Number of Rows and Columns : ");

            m = int.Parse(Console.ReadLine());

            n = int.Parse(Console.ReadLine());

            int[,] a = new int[m, n];

            Console.WriteLine("Enter the First Matrix");

            for (i = 0; i < m; i++)

            {

                for (j = 0; j < n; j++)

                {

                    a[i, j] = int.Parse(Console.ReadLine());

                }

            }

            Console.WriteLine("First matrix is:");

            for (i = 0; i < m; i++)

            {

                for (j = 0; j < n; j++)

                {

                    Console.Write(a[i, j] + "\t");

                }

                Console.WriteLine();

            }

            int[,] b = new int[m, n];

            Console.WriteLine("Enter the Second Matrix");

            for (i = 0; i < m; i++)

            {

                for (j = 0; j < n; j++)

                {

                    b[i, j] = int.Parse(Console.ReadLine());

                }

            }

            Console.WriteLine("Second Matrix is :");

            for (i = 0; i < 2; i++)

            {

                for (j = 0; j < 2; j++)

                {

                    Console.Write(b[i, j] + "\t");

                }

                Console.WriteLine();

            }

            Console.WriteLine("Matrix Multiplication is :");

            int[,] c = new int[m, n];

            for (i = 0; i < m; i++)

            {

                for (j = 0; j < n; j++)

                {

                    c[i, j] = 0;

                    for (int k = 0; k < 2; k++)

                    {

                        c[i, j] += a[i, k] * b[k, j];

                    }

                }

            }

            for (i = 0; i < m; i++)

            {

                for (j = 0; j < n; j++)

                {

                    Console.Write(c[i, j] + "\t");

                }

                Console.WriteLine();

            }


            

        }

    }

}


ASP stands for "Active Server Pages." It's a technology developed by Microsoft for creating dynamic web pages and web applications. With ASP, you can embed server-side scripts within HTML pages to generate dynamic content.


.NET stands for "Network Enabled Technology." It's a software development framework developed by Microsoft that provides a controlled environment for building and running applications.


.NET is a software framework developed by Microsoft that primarily runs on Microsoft Windows. It provides a large library of pre-coded solutions to common programming problems and a runtime environment for executing and managing applications.


A class in programming is like a blueprint for creating objects with specific properties and actions. It defines what an object can do and what data it can hold.

A function is like a mini-program within a bigger program. It's a set of instructions designed to do a specific job, like adding numbers together or formatting text.


Comments

Popular posts from this blog

Characteristics or researchers

Neo4j

Write a python program to implement multiple linear regression for given dataset