Objective: - Program To Display The Addition Substruction Multiplication and Division of Two Number Using Console Applications
Objective: - Program To Display The Addition Substruction Multiplication and Division of Two Number Using Console Applications
Objective: - Program to display the addition substruction multiplication and division of two
number using console applications.
using System;
namespace Calculator
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the first number: ");
double num1 = Convert.ToDouble(Console.ReadLine());
Console.ReadKey();
}
}
}
Output: -
Enter the first number: 15
Enter the second number: 5
Addition: 20
Subtraction: 10
Multiplication: 75
Division: 3
[LAB-2]
Objective: - Program to display the first 10 natural numbers and their sum using console
application.
using System;
namespace NaturalNumbers
class Program
int sum = 0;
Console.WriteLine(i);
sum += i;
Console.ReadKey();
Output: -
The first 10 natural numbers are:
1 2 3 4 5 6 7 8 9 10
using System;
using System.Windows.Forms;
namespace AddNumbers
public Form1()
InitializeComponent();
}
[LAB-4]
Objective: - Write a program to convert input string from lower to upper and upper to lower
case.
using System;
namespace CaseConverter
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter a string: ");
string input = Console.ReadLine();
Console.ReadKey();
}
}
}
Output: -
Enter a string: Abhishek Yadav
Upper case: ABHISHEK YADAV
Lower case: abhishek yadav
[LAB-5]
Objective: - Write a program to simple calculator using windows application.
using System;
using System.Windows.Forms;
namespace Calculation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double num1 = double.Parse(textBox1.Text);
double num2 = double.Parse(textBox2.Text);
double sum = num1 + num2;
label3.Text = "Result: " + sum.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
double num1 = double.Parse(textBox1.Text);
double num2 = double.Parse(textBox2.Text);
double difference = num1 - num2;
label3.Text = "Result: " + difference.ToString();
}
<div class="text-center">
<p>Learn about Web development refers to the creating, building, and maintaining of
websites.</p>
<h3>Subscribe</h3>
</div>
*Open the Default.aspx.cs file and replace the content with the following code:
(csharp)
using System;
using System.Web.UI;
namespace MyWebApp
}
[LAB-7]
Objective: - Write a program working with forms using ASP.NET
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<h1>User Registration</h1>
<label for="name">Name:</label>
<label for="email">Email:</label>
</form>
</div>
[LAB-8]
Objective: - Write a program to connectivity with Microsoft sql database
using System;
using System.Data.SqlClient;
namespace SQLConnectivity
{
class Program
{
static void Main(string[] args)
{
string connectionString = "Data Source=YourServerName;Initial
Catalog=YourDatabaseName;User ID=YourUsername;Password=YourPassword;";
try
{
using (SqlConnection connection = new SqlConnection
(connectionString))
{
connection.Open();
connection.Close();
}
}
catch (SqlException ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Console.ReadKey();
}
}
}
[LAB-9]
Objective: - Write a program to access data source through ADO.NET
using System;
using System.Data.SqlClient;
namespace ADOdotNETExample
{
class Program
{
static void Main(string[] args)
{
string connectionString = "Data Source=YourServerName;Initial
Catalog=YourDatabaseName;User ID=YourUsername;Password=YourPassword;";
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
while (reader.Read())
{
Console.WriteLine(reader[0].ToString() + " " + reader[1].ToString());
}
reader.Close();
}
}
catch (SqlException ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Console.ReadKey();
}
}
}
[LAB-10]
Objective: - Write a program to display the following feedback form
<div class="text-center">
<h1>Feedback Form</h1>
<form id="feedbackForm">
<div class="form-group">
</div>
<div class="form-group">
</div>
<div class="form-group">
</div>
</form>
</div>