In this tutorial learn how you can write a c program to find mn. Where m and n are integers and must be given by the user.
We are using for loop to calculate the power of the given number 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.
Here is the code to find mn. Where m and n are integers and must be given by user in C programming.
#include <stdio.h> //WAP to find mn. Where m and n are integers and must be given by user.
int main()
{
int m, n, mn = 1, i;
printf("Enter the base:");
scanf("%d", &m);
printf("Enter the exponent:");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
mn = mn * m;
}
printf("The value of mn is %d.", mn);
return 0;
}
This is how you can find mn. Where m and n are integers and must be given by user in c programming. Comment below if you like our tutorial.