Untitled

 avatar
unknown
c_cpp
a year ago
711 B
6
Indexable
#include <iostream>
using namespace std;
double power(double A, int B) 
{
    if (B == 0) 
    {
        return 1;
    }
    else {
        double result = A;
        for (int i = 1; i < B; i++) 
        {
            result *= A;
        }
        return result;
    }
}
int calculatekrytost(int press, int fives, int weight)
{
    int k = power(press + weight, fives);
    return k;
}
int main() 
{
    int press, fives, weight;
    cout << "cubes: ";
    cin >> press;
    cout << "fives: ";
    cin >> fives;
    cout << "weight bar: ";
    cin >> weight;
    int krytost = calculatekrytost(press, fives, weight);
    cout << "krytost: " << krytost << endl;
    return 0;
}
Editor is loading...
Leave a Comment