C# Sharp Exercises: Print the output of multiplication of three numbers which will be entered by the user
C# Sharp Basic: Exercise-6 with Solution
Write a C# Sharp program to print the output of multiplication of three numbers which will be entered by the user.
C# Sharp multiplication (*) operator :
The multiplication operator (*), which computes the product of its operands. Also, the dereference operator, which allows reading and writing to a pointer.
Note:
- All numeric types have predefined multiplication operators.
- The * operator is also used to declare pointer types and to dereference pointers.
- User-defined types can overload the binary * operator. When a binary operator is overloaded, the corresponding assignment operator, if any, is also implicitly overloaded.
Sample Solution:
C# Sharp Code:
using System;
public class Exercise6
{
public static void Main()
{
int num1, num2, num3;
Console.Write("Input the first number to multiply: ");
num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input the second number to multiply: ");
num2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input the third number to multiply: ");
num3 = Convert.ToInt32(Console.ReadLine());
int result = num1 * num2 * num3;
Console.WriteLine("Output: {0} x {1} x {2} = {3}",
num1, num2, num3, result);
}
}
Sample Output:
Input the first number to multiply: 2 Input the second number to multiply: 8 Input the third number to multiply: 5 Output: 2 x 8 x 5 = 80
Flowchart:
C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to swap two numbers.
Next: Write a C# Sharp program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework