Program 41 #P41 - C Program to Calculate the Power of a Number Using POW function #C156

preview_player
Показать описание
The program below takes two integers from the user (a base number and an exponent) and calculates the power.

For example: In case of 23

2 is the base number
3 is the exponent
And, the power is equal to 2*2*2
#rubalsolutions #coding #developer #programming #programmer #technology #clanguage #computerscience #c #informaticpractices #sub #subscribe #youtube #newyoutuber #youtubechannel
The above technique works only if the exponent is a positive integer.

To Install Turbo C++ 4.5 Click on Below Link and Download rar file and extract and then install..
Do Like,Comment,Share and Subscribe if u are learning little bit.
Please give me suggestions in form of comment box .

Рекомендации по теме
Комментарии
Автор

#include <stdio.h>
#include <math.h>

int main()
{
double base, exponent, result;

printf("Enter a base number: ");
scanf("%lf", &base);

printf("Enter an exponent: ");
scanf("%lf", &exponent);

// calculates the power
result = pow(base, exponent);

printf("%.1lf^%.1lf = %.2lf", base, exponent, result);

return 0;
}

RubalSolutions
join shbcf.ru