This is a C# Program to perform multiplication of exponents of same base.
Problem Description
This C# Program Performs Multiplication of Exponents of Same Base.
Problem Solution
Here the power value for all same base is found.
Program/Source Code
Here is source code of the C# Program to Perform Multiplication of Exponents of Same Base. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Perform Multiplication of Exponents of Same Base */ using System; class Program { static void Main() { Console.WriteLine("Enter the Base : "); double num = double.Parse(Console.ReadLine()); Console.WriteLine("Enter the First Exponent :"); double exp1 = double.Parse(Console.ReadLine()); Console.WriteLine("Enter the Second Exponent :"); double exp2 = double.Parse(Console.ReadLine()); double mul; mul = exp1 + exp2; Console.WriteLine("Result is : {0}^{1} : {2}", num, mul, Math.Pow(num, mul)); Console.ReadLine(); } }
Program Explanation
In this C# Program, we are reading the base, the first exponent, and the second exponent using ‘num’, ‘exp1’, ‘exp2’ variables respectively. Compute the difference between the values of ‘exp1’ variable by the value of ‘exp2’ variable.
advertisement
advertisement
Runtime Test Cases
Enter the Base : 2 Enter the First Exponent : 3 Enter the Second Exponent : 2 Result is : 2^5 : 32
Sanfoundry Global Education & Learning Series – 1000 C# Programs.
If you wish to look at all C# Programming examples, go to 1000 C# Programs.
Next Steps:
- Get Free Certificate of Merit in C# Programming
- Participate in C# Programming Certification Contest
- Become a Top Ranker in C# Programming
- Take C# Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Related Posts:
- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Buy MCA Books
- Buy Computer Science Books
- Buy C# Books