Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Assignment 1 Codes

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace Assignment1

class Assignment1

static void Main(string[] args)

Console.WriteLine(" C# Assignment 1 ");

Console.WriteLine("Enter the first value");

int a = int.Parse(Console.ReadLine());

Console.WriteLine("Enter the second value");

int b = int.Parse(Console.ReadLine());

Console.WriteLine("Enter the third value");

int c = int.Parse(Console.ReadLine());

Console.WriteLine("Enter the fourth value");

int d = int.Parse(Console.ReadLine());

Console.WriteLine("Enter the fifth value");

int e = int.Parse(Console.ReadLine());

int sum = a + b + c + d + e;

Console.WriteLine("The value of sum =" + sum);

Console.ReadKey();

}
Question 2

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace Circlearea

class Program

static void Main(string[] args)

int r = 5;

float PI = 3.14f;

float area = PI * r * r;

Console.WriteLine("Area of circle =" + area);

Console.ReadKey();

}
}

Question 3

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace nameandaddress

class Program

static void Main(string[] args)

Console.WriteLine("Firts Name: Sajith ");

Console.WriteLine("Last Name: Subrahmanyan");

Console.WriteLine("City: Winnipeg ");

Console.WriteLine("Province: Manitoba");
Console.WriteLine("Title of this course : Network Security Diploma");

Console.ReadKey();

Type 2

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace name_add

class Program

static void Main(string[] args)

{
Console.WriteLine("Enter your first name");

string fname = Console.ReadLine();

Console.WriteLine("Enter your last name");

string lname = Console.ReadLine();

Console.WriteLine("Enter the name of city");

string city = Console.ReadLine();

Console.WriteLine("Enter the name of province");

string province = Console.ReadLine();

Console.WriteLine("Enter the name of your course");

string course = Console.ReadLine();

Console.WriteLine("\n" + "#============================#" + "\n");

Console.WriteLine("first name: " + fname + "\n \n" + "last nanme: " + lname + "\n \n" + "city: "
+ city + "\n \n" + "Province: " + province + "\n \n" + "Course: " + course);

Console.ReadKey();

You might also like