0% found this document useful (0 votes)
2K views2 pages

Practical No.: 01: AIM: Write A Console Application That Obtains Four Int Values From The User and Displays The

The document describes a C# console application that gets 4 integer values from the user as input and displays the product of those numbers. It prompts the user to enter 4 numbers, uses Convert.ToInt32 to convert the user input to integers, calculates the product, and displays the product and inputs as a mathematical equation.

Uploaded by

Sohit Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views2 pages

Practical No.: 01: AIM: Write A Console Application That Obtains Four Int Values From The User and Displays The

The document describes a C# console application that gets 4 integer values from the user as input and displays the product of those numbers. It prompts the user to enter 4 numbers, uses Convert.ToInt32 to convert the user input to integers, calculates the product, and displays the product and inputs as a mathematical equation.

Uploaded by

Sohit Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PRACTICAL NO.

: 01

AIM: Write a console application that obtains four int values from the user and displays the
product.
Hint: you may recall that the Convert.ToDouble() command was used to convert the input from
the console to a double; the equivalent command to convert from a string to an int is
Convert.ToInt32().

CODE:
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int num1, num2,num3,num4,prod;
Console.Write("Enter number 1: "); num1 =
Int32.Parse(Console.ReadLine());
Console.Write("Enter number 2: ");
num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 3: ");
num3 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number 4: ");
num4 = Convert.ToInt32(Console.ReadLine());
prod = num1 * num2 * num3 * num4;
Console.WriteLine(num1 + "*" + num2 + "*" + num3 + "*" + num4 + "=" + prod);
}
}
}

OUTPUT:
Enter number 1: 6
Enter number 2: 5
Enter number 3: 4
Enter number 4: 3
6*5*4*3=360

You might also like