Professional Documents
Culture Documents
BSE1A Zain Rizvi CPOEL1
BSE1A Zain Rizvi CPOEL1
NOTE:
Solution:
int i, j;
int[,] arr1 = new int[3, 3];
Console.Write("------------------------------------------------------\n");
//Input Matrix
Console.Write("Input elements in the matrix :\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
Console.Write("element - [{0},{1}] : ", i, j);
arr1[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
//Out Put Matrix
Console.Write("\nThe matrix is : \n");
for (i = 0; i < 3; i++)
{
Solution:
using System;
namespace Mids
{
class Program
{
TASK # 03: The distance between two cities (in km) as input from user. Write a Program to
print the distance in any of the following unit according to user requirements: (Marks: 10)
1 kilometer = 1000 meters
1 kilometer = 3280.8399 feet
1 kilometer = 39370.0787 inch
1 kilometer = 100000 cm
Solution:
using System;
using System.Collections.Generic;
using System.Text;
namespace Mids
{
class Task_03
{
public void task3() {
Console.Write("Enter The Distance (In KM):");
double dist = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Press 1 for km to meter ");
Console.WriteLine("Press 2 for km to feet ");
Console.WriteLine("Press 3 for km to inch ");
Console.WriteLine("Press 4 for 1 km to 100000 cm ");
Console.WriteLine("__________________________");
int opt = Convert.ToInt32(Console.ReadLine());
double result = 0;
if (opt == 1)
{
Console.WriteLine("The Calculated distance in meter is " + dist *
1000);
}
else if (opt == 2)
{
Console.WriteLine("The Calculated distance in feet " + dist *
3280.8399);
}
}
}
}