You are on page 1of 9

Marwadi University

Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

1. Write a program to get user input as below :


A) Enter First Number :
B) Enter Second Number :
C) Choose Operation to perform (1 - Addition, 2 - Subtraction, 3 - Multiplication, 4 -
Division, 5 - Modulo Division

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleApp2;
namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
int var1, var2, sum = 0, choice, start;
Console.WriteLine("enter 1st value: -");
var1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter 2st value: -");
var2 = Convert.ToInt32(Console.ReadLine());
start:
Console.WriteLine("1. Addition");
Console.WriteLine("2. Substraction");
Console.WriteLine("3. Division");
Console.WriteLine("4. Multiplication");
Console.WriteLine("5. Modulo Division");
Console.WriteLine("6. Exit");
string outputStr = "{0} of {1} and {2} is {3}";
choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
case 1:
{
Console.WriteLine(outputStr, "Addition", var1, var2, var1 + var2);
goto start;
}
case 2:
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

{
Console.WriteLine(outputStr, "Substraction", var1, var2, var1 - var2);
goto start;
}
case 3:
{
Console.WriteLine(outputStr, "Divison", var1, var2, var1 / var2);
goto start;
}
case 4:
{
Console.WriteLine(outputStr, "Multiplication", var1, var2, var1 * var2);
goto start;
}
case 5:
{
Console.WriteLine(outputStr, "Modulo Division", var1, var2, var1 % var2);
goto start;
}
case 6:
{
Console.ReadLine();
break;
}
default:
{
goto start;
}
}
}
}
}
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

OUTPUT:
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

2.Write a program to Show different input options based on UserType


A) If Student userType is selected then should have different options to choose
B) If Faculty userType is selected then should have different options to choose

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program2_48
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter your UserType Student or Faculty: ");
String Type;
Type = Console.ReadLine();
String id,name,sem,exp;
if (Type == "Student")
{
Console.WriteLine("Enter your Student ID: ");
id = Console.ReadLine();
Console.WriteLine("Enter Student name: ");
name = Console.ReadLine();
Console.WriteLine("Enter Student sem: ");
sem = Console.ReadLine();
}
else if (Type == "Faculty")
{
Console.WriteLine("Enter Faculty Name: ");
name = Console.ReadLine();
Console.WriteLine("Enter Faculty Experience: ");
exp = Console.ReadLine();
}
else
{
Console.WriteLine("Input the correct option");
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

}
Console.ReadKey();
}
}
}

OUTPUT:
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

3. Write a program to Generate Student mark sheet where user have to Enter
subject wise
marks and at the end user’s inputs are completed, Show Marksheet depending
upon user
inputs.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program_48
{
class Program
{
static void Main(string[] args)
{
String net,daa,ml,dsip,cn;
Console.WriteLine("Enter the marks for .net out of 100 ");
net = Console.ReadLine();
Console.WriteLine("Enter the marks for daa out of 100 ");
daa = Console.ReadLine();
Console.WriteLine("Enter the marks for ml out of 100");
ml = Console.ReadLine();
Console.WriteLine("Enter the marks for dsip out of 100 ");
dsip = Console.ReadLine();
Console.WriteLine("Enter the marks for cn out of 100 ");
cn = Console.ReadLine();
Console.WriteLine("----------Marksheet---------- ");
Console.WriteLine("Maths marks {0}", net);
Console.WriteLine("Physics marks {0}", daa);
Console.WriteLine("Chemistry marks {0}", ml);
Console.WriteLine("English marks {0}", dsip);
Console.WriteLine("Computer marks {0}", cn);
int total = Convert.ToInt32(net) + Convert.ToInt32(daa) + Convert.ToInt32(ml) +
Convert.ToInt32(dsip) + Convert.ToInt32(cn);
Console.WriteLine("Total Marks {0}", total);
Console.WriteLine("Percentage = {0}", (total / 5));
Console.WriteLine("----------------------------- ");
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

Console.ReadKey();
Console.ReadKey();
Console.ReadKey();
}
}
}

OUTPUT:
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

4. Write a program to get user loan amount and print Emi details with Principal
and Loan
amount segregation for each month EMI.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace assignment_1_4
{
internal class Program
{
public static void Main(string[] args)
{
float p, r, t, emi;
Console.WriteLine("Enter principal amount: ");
p = float.Parse(Console.ReadLine());
Console.WriteLine("Enter annual interest rate: ");
r = float.Parse(Console.ReadLine());
Console.WriteLine("Enter number of months: ");
t = float.Parse(Console.ReadLine());
r = r / (12 * 100);
t = t * 12;
emi = (p * r * (float)Math.Pow(1 + r, t)) / (float)(Math.Pow(1 + r, t) - 1);
Console.WriteLine("Monthly EMI is = " + emi);
Console.ReadLine();
}
}
}
Marwadi University
Faculty of Technology
Department of Information and Communication
Technology
Subject: .NET
Technologies

Date:
Experiment No: 01 Enrolment No: 92110133031
16/10/2022
Name : Umang Parmar

OUTPUT:

You might also like