C# Program to Print the Edge Values in Power Function

This C# program calculates and prints the edge values of a power function.

Problem statement

Given a base and an exponent, this program calculates the edge values\n” + “of the power function for a range of inputs and prints the results.

C# Program to Print the Edge Values in Power Function

using System;

class Program
{
    static void Main()
    {
        // Introduction
        Console.WriteLine("Power Function Edge Values Calculator");
        Console.WriteLine("------------------------------------\n");

        // Problem Statement
        Console.WriteLine("Given a base and an exponent, this program calculates the edge values\n" +
                          "of the power function for a range of inputs and prints the results.\n");

        // Input
        Console.Write("Enter the base: ");
        double baseValue = double.Parse(Console.ReadLine());

        Console.Write("Enter the exponent: ");
        int exponent = int.Parse(Console.ReadLine());

        Console.Write("Enter the starting value for the range: ");
        double startValue = double.Parse(Console.ReadLine());

        Console.Write("Enter the ending value for the range: ");
        double endValue = double.Parse(Console.ReadLine());

        // Program
        Console.WriteLine("\nResults:");

        for (double x = startValue; x <= endValue; x++)
        {
            double result = Math.Pow(baseValue, x);
            Console.WriteLine($"Base^{x} = {result}");
        }

        // How it works
        Console.WriteLine("\nHow It Works:");
        Console.WriteLine("1. You enter the base and exponent for the power function.");
        Console.WriteLine("2. You specify a range of input values.");
        Console.WriteLine("3. The program calculates and prints the result of the power function for each value in the specified range.");
    }
}

How it works

  1. You enter the base and exponent for the power function.
  2. You specify a range of input values.
  3. The program calculates and prints the result of the power function for each value in the specified range.

Input / output

C# Program to Print the Edge Values in Power Function

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...