C Sharp programs
C Sharp programs
Practicals:
--------
Output:
Which is your fav. color
1. Red
2. Green
3. Pink
8
None of given colors..
Output:
Printing first 20 numbers using For
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 3. Multithreading
using System;
using System.Threading;
namespace ThreadingDemo
{
class Program1
{
public static void Main()
{
Console.WriteLine("Starting Main Thread");
Thread t1 = new Thread(Table7)
{
Name = "Table-7"
t1.Start();
t2.Start();
}
}
namespace ConsoleApplication2
{
class Subroutine
{
public static void Main()
{
Console.WriteLine("Arithmetic Operations:");
Console.WriteLine("Enter two numbers:");
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
Console.WriteLine("1. Add");
Console.WriteLine("2. Sub");
Console.WriteLine("Enter Your Choice: ");
int ch = int.Parse(Console.ReadLine());
if (ch != 1 && ch != 2)
{
Console.WriteLine("Wrong Choice!!");
}
else if (ch == 1)
{
add(a, b);
}
else
{
int result = sub(a, b);
Console.WriteLine("Subtraction=" + result);
}
Console.Read();
}
NOTE:
C# code:
Select New Project-> Under Installed Templates-> Visual Basic -> Windows
Forms Application.
NOTE:
VB code:
Public Class Form1
End Sub
End Class
Select New Project-> Under Installed Templates-> Visual Basic -> Windows
Forms Application.
Design of Form1.vb:
VB code:
Design of Form1.vb:
NOTE:
● In Form1 - IsMdiContainer is set to True.
Design of Form2.vb:
VB Code in Form2:
Public Class Form2
Output Screen: