Lab Practical File of "Dot Net Lab" Subject Code-CSP0503 (P)
Lab Practical File of "Dot Net Lab" Subject Code-CSP0503 (P)
Lab Practical File of "Dot Net Lab" Subject Code-CSP0503 (P)
Submitted by
B.Tech(CSE)
Submitted to
Asst. Prof. Rahul Yadav
Department of CSE
INDEX
S.No Title Page No
1. Write a C# Sharp program to print on screen the output of adding, subtracting, 2
multiplying and dividing of two numbers which will be entered by the user.
10. Find the sum of all the elements present in a jagged array of 3 inner arrays. 18
11. Write a program in C# Sharp to separate odd and even integers in separate 21
arrays.
12. Write a program in C# Sharp to read an array and remove the duplicate 25
elements from it.
13. 26
Write a C# Program to print Number Triangle.
14. Write a C# Program Store and Display Employee Information. 28
15. Write a Program in C# using Internal Access Specifier. 30
1
1.Write a C# Sharp program to print on screen the output of adding, subtracting, multiplying and
dividing of two numbers which will be entered by the user.
using System;
input1 = int.Parse(Console.ReadLine());
input2 = int.Parse(Console.ReadLine());
2
Console.Write("Multiplication= " + multiplication + "\n");
Console.ReadKey();
}}
3
2. Write a C# Sharp Program to check number is whether EVEN or ODD without using any arithmetic
or relational operators.
using System;
int input1;
input1 = int.Parse(Console.ReadLine());
else
Console.ReadKey();
}}
4
5
6
3. Write a C# Sharp program that takes a number as input and print its multiplication table.
using System;
int i, num;
//Reading number
num = Convert.ToInt32(Console.ReadLine());
Console.ReadKey();
7
8
4. Write a C# program and compute the sum of the digits of an integer.
using System;
int n, sum = 0, m;
n = int.Parse(Console.ReadLine());
while (n > 0)
m = n % 10;
sum = sum + m;
n = n / 10;
Console.ReadKey();
9
5. Write a program in C# Sharp to display the number in reverse order.
using System;
n = int.Parse(Console.ReadLine());
while (n != 0)
rem = n % 10;
n /= 10;
Console.Read();
}}
10
6. Write a program in C# Sharp to check whether a number is a palindrome or not.
using System;
n = int.Parse(Console.ReadLine());
temp = n;
while (n > 0)
r = n % 10;
n = n / 10;
if (temp == sum)
Console.Write("Number is Palindrome.");
else
Console.ReadKey();
11
12
7.Write a C# Sharp program to check whether a given number is an Armstrong number or not.
using System;
n = int.Parse(Console.ReadLine());
temp = n;
while (n > 0)
r = n % 10;
n = n / 10;
if (temp == sum)
Console.Write("Armstrong Number.");
else
Console.Read();
13
14
8.Write a program in C# Sharp to create a function to swap the values of two integer numbers.
using System;
temp = x;
x = y;
y = temp;
number1 = x;
number2 = y;
number1 = int.Parse(Console.ReadLine());
number2 = int.Parse(Console.ReadLine());
swap(number1, number2);
Console.Write("The swaped values are X={0} and Y={1} " ,number1,number2 + "\n");
Console.ReadKey(); }}
15
16
9. Write a program in C# Sharp to create a function to calculate the area & Perimeter of a Rectangle.
using System;
double AOR;
AOR = x * y;
return (AOR);
double POR;
POR = 2 * (x + y);
return POR;
length = Convert.ToDouble(Console.ReadLine());
breadth = Convert.ToDouble(Console.ReadLine());
17
Console.Write("The rectangle area={0} and perimeter={1}", area,perimeter+"\n");
Console.ReadKey();
18
10. Find the sum of all the elements present in a jagged array of 3 inner arrays.
using System;
class JaggedArrays
jagged[0][i] = int.Parse(Console.ReadLine());
jagged[1][i] = int.Parse(Console.ReadLine());
jagged[2][i] = int.Parse(Console.ReadLine());
19
int sum = 0;
Console.Write(jagged[0][i] + "\t");
Console.Write(jagged[1][i] + "\t");
Console.Write(jagged[2][i] + "\t");
20
{
JA.ReadArrays();
JA.PrintArrays();
JA.FindSum();
Console.ReadLine();
21
11. Write a program in C# Sharp to separate odd and even integers in separate arrays.
using System;
int i, j = 0, k = 0, n;
Console.Write("------------------------------------------------------\n");
n = Convert.ToInt32(Console.ReadLine());
arr1[i] = Convert.ToInt32(Console.ReadLine());
if (arr1[i] % 2 == 0)
arr2[j] = arr1[i];
22
j++;
else
arr3[k] = arr1[i];
k++;
Console.Write("\n\n");
Console.ReadKey();
23
24
12.Write a program in C# Sharp to read an array and remove the duplicate elements from it.
using System;
using System.Linq;
int n,flag;
int[] intArray;
n = int.Parse(Console.ReadLine());
intArray[i]= int.Parse(Console.ReadLine());
Console.ReadKey();
}}
25
26
13. Write a C# Program to print Number Triangle.
using System;
int i, j, k, l, n;
n = int.Parse(Console.ReadLine());
Console.Write(" ");
Console.Write(k);
Console.Write(l);
Console.Write("\n");
27
}
Console.ReadKey();
28
14. Write a C# Program Store and Display Employee Information.
using System;
id = i;
name = n;
salary = s;
class shashidatt_program14
29
e2.insert(102, "shashi datt", 490000f);
e1.display();
e2.display();
Console.ReadKey();
30
15. Write a Program in C# using Internal Access Specifier.
using System;
namespace AccessSpecifiers
class InternalTest
class Shashidatt_program_15
internalTest.Msg("Btech.cse");
Console.ReadKey();
31
32