In this tutorial learn how you can write a c program to find mn. Where m and n are integers and consider the value of n be negative and 0 which is given by user.

We are using <math.h> header and pow() function for this tutorial.

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.

Write a Program to Find mn where m and n are Integers and Value of n be Negative and 0

Here is the code to find mn. Where m and n are integers and consider the value of n be negative and 0 which is given by user. in C programming.

#include <stdio.h> //WAP to find mn. Where m and n are integers and consider the value of n be negative and 0 which is given by user.
#include <math.h>
int main()
{
    double m, n, mn;
    printf("Enter the base:");
    scanf("%lf", &m);
    printf("Enter the exponent value negative or 0:");
    scanf("%lf", &n);
    mn = pow(m, n);
    printf("The value of mn is %.2lf.", mn);
    return 0;
}

Test Live At Jdoodle

Conclusion

This is how you can find mn. Where m and n are integers and consider the value of n be negative and 0 which is given by user. in c programming. Comment below if you like our tutorial.