# Functions

First of all, below you can find the solution to your last homework/classwork program, where you have to print out a positive integer backwards.
```#include <stdio.h>
#include "/home/cc/atdp4/su04/staff/atdp4-rc/inc/simpio.h"

int main() {
int n, rightdigit;
printf("Enter a positive integer: ");
n = GetInteger();

do {
rightdigit = n % 10;
printf("%d", rightdigit);
n /= 10;
} while (n != 0);

printf("\n");
return 0;
}
```
Functions are like mini-programs, which are separate subroutines from your main function, and are called from your main function.
Remember that functions have a data type -- of the return value, arguments -- information that you pass into the functions, a function name -- used to identify the function you are calling and declaring, a return value -- what you are passing back to the main program, as well as declarations and definitions -- what the function does.
Below is an example of a program that has a function called "Addition," which simply adds two integers and return the sum as an integer.
```int Addition(int a, int b);

int main() {
printf("Enter first integer: ");
x = GetInteger();
printf("Enter second integer: ");
y = GetInteger();
printf("%d + %d = %d\n", x, y, answer);
return 0;
}

int Addition(int a, int b) {
int ans;
ans = a + b;
return ans;
}
```
Classwork program #1
Your classwork program is to work on problem #5 on page 180 on your textbook. The RaiseIntToPower() function takes in two arguments or parameters, x and k, the base and the power, correspondingly. Below you can find my solution to this problem.
```#include <stdio.h>

int main() {
int i, result;
for (i = 0; i <= 10; i++) {
result = RaiseIntToPower(2, i);
printf("%d^%d = %d\n", 2, i, result);
}
}

int RaiseIntToPower(int x, int k) {