C# program to calculate the volume of a cone
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to calculate the NPR is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
Here, we created a class Npr that contains three static methods CalculateFactorial(), CalculateNpr(), and Main() method.
The CalculateFactorial() is used to calculate the factorial of the specified factorial and return to the calling method.
The CalculateNpr() is used to calculate the Npr using the below formula.
The Main() method is the entry point for the program, Here we read the value of n and r and called the CalculateNpr() method that will return NPR that will be printed on the console screen.