Name: Muhammad Fawad ID NAME: 12699 Course: PF Lab: Using Using Using Using Namespace Class Static Void String

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

NAME: MUHAMMAD FAWAD

ID NAME: 12699
COURSE: PF LAB

Lab-10 Exercises: 1. Create a two dimensional array that can store


below values in same rows and columns. Get value from user input and
store in array after that using for-loop, program to show a below
multiplication table. 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15
18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18
24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9
18 27 36 45 54 63 72 81

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\t\t\t----------------------------------------------------
---");
Console.WriteLine("\t\t\t To Print a Program That Show The Multiplication
Table");
Console.WriteLine("\t\t\t----------------------------------------------------
---");
Console.WriteLine("\a");
int[,] twodimensionarray = new int[9,9] {
{1,2,3,4,5,6,7,8,9},
{2,4,6,8,10,12,14,16,18},
{3,6,9,12,15,18,21,24,27},
{4,8,12,16,20,24,28,32,36},
{5,10,15,20,25,30,35,40,45},
{6,12,18,24,30,36,42,48,54},
{7,14,21,28,35,42,49,56,63},
{8,16,24,32,40,48,56,64,72},
{9,18,27,36,45,54,63,72,81}
};
for (int i = 0; i < twodimensionarray.GetLength(0); i++)
{
for (int j = 0; j < twodimensionarray.GetLength(1); j++)
{
Console.Write("\t"+twodimensionarray[i,j]);
}
Console.WriteLine();
}

Console.ReadKey();

}
}
}
2. Write a program that will store your schedule like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\t\t\t\t---------------------------------------------");
Console.WriteLine("\t\t\t\t To Print A Program That Store Your Schedule");
Console.WriteLine("\t\t\t\t---------------------------------------------");
Console.WriteLine("\a");
Console.WriteLine("\a");
Console.WriteLine("\a");
string[,] my_array = new string[6, 5]{

{""," Period1","Period2","Period3","Period4"},
{"Monday ","Off","Off","PF","PF"},
{"Tuesday ","Off","Off","PIS","PIS"},
{"Wednesday","IICT","IICT","off","off"},
{"Thursday","VLM","VLM","IICTlab","IICT lab"},
{"Friday ","Off","Off","PF Lab","PF Lab"}
};
for (int i = 0; i < my_array.GetLength(0); i++)
{
for (int j = 0; j < my_array.GetLength(1); j++)
{
Console.Write("\t\t"+my_array[i,j]);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}

You might also like