You are on page 1of 4

BAHRIA UNIVERSITY, ISLAMABAD

Department of Computer Science

Visual Programming
Lab Journal 1

Student Name: Salman Ayub Khan


Enrolment No.: 01-235181-051

Title: Introduction to Visual studio and C#.NET


Objectives: To study and understand the working of visual studio for c#.NET
Tools Used: visual studio 2019

Procedure: Open VS and perform the following tasks

Exercise 1.1

Create a console application for C#.NET.

Create a simple Hello World Program. This program should display “Hello World!” on screen. The
console should also stop on screen after displaying it. Make sure that the screen does not close.

Visual Programming Lab Journal 1 01-235181-051


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

namespace vp_lab_1
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("Hello World");
Console.ReadLine();
}
}
}

Exercise 1.2

Create a console application for C#.NET.

Take input from user and store in a char variable. Take another input and store in an integer
variable. Make sure to convert the input where necessary.

At the end, display these two messages on screen.

“The char input was ______ .”

“The integer input was _____.”

Visual Programming Lab Journal 1 01-235181-051


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

namespace vp_lab_1
{
class Program
{
static void Main(string[] args)
{

Console.Write("Enter Something :");


//input variable
int x= Convert.ToInt32(Console.ReadLine());
Console.WriteLine("“The integer input was " + x);
//char input
Console.Write("Enter Something :");
char y = Convert.ToChar(Console.ReadLine());
Console.WriteLine("The character was " + y);

Console.ReadLine();

}
}
}

Exercise 1.3

Create a console application for C#.NET.

Take an integer number from user. Print the table of the number entered by user on screen in the
following format.
For example, if input is 2 then.

Visual Programming Lab Journal 1 01-235181-051


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

namespace vp_lab_1
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("Enter the number do you want a table :");


int num=Convert.ToInt32(Console.ReadLine ());
for (int i = 1; i <=10 ; i++)
{
Console.WriteLine(num + "x" + i +" = " + i*num);

Console.ReadLine();

}
}
}

Submission Date: Signature Ms. Umarah Qaseem

Visual Programming Lab Journal 1 01-235181-051

You might also like