Arithmetic Functions

Question

Solution

Idea

Quite simple question, just follow the instructions.

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/arithmeticfunctions/arithmeticfunctions.cpp
#include "arithmeticfunctions.h"

// Compute x^3
int cube(int x){
    return x * x * x;
}

// Compute the maximum of x and y
int max(int x, int y){
    return x >= y ? x : y;
}

// Compute x - y
int difference(int x, int y){
    return x - y;
}

Last updated