# Thread: a really really simple problem...

1. ## a really really simple problem...

i really need a big help..
i just started learning C++..
the problem is this..

i need to write a code in which
the user inputs two numbers (3 and 5, for example..)
and it goes as follows:
243

which is..
3 x 3 x 3 x 3 x 3...
notice how 3(the first number) was multiplied 5(second number) times.
this needs to be done using two functions..
and it needs to include #include<stdio.h>

int main(void) and
int multiply(int a)

2. So have you done either of these?
- for loops

If you have, you're not completely stuck.

Also, stdio.h is C, not C++.
So you need to clarify which you're actually using.

3. Your actually talking about the "base - exponent" feature of integers.
As a small hint, try to think how you would calculate that. You know it will use mutliplication, but the trick is deciding what to multiply against what, and how many times.

4. wow thanks a lot
that helped alot
took me some time, but got it done ha!

5. Code:
```#include <stdio.h>
#include <math.h>

int power(int, int);

int main()
{
int x, y, z;

printf("Please enter two numbers : \n");
scanf("&#37;d",&x);
scanf("%d",&y);
z = power(x,y);

printf("%d power %d : %d\n", x, y, z);
}

int power(int a, int b)
{
if (b==1)
return a;

else
return (a * power(a, b-1));
}```
oh... C.. right. hehe
this is how i got it done..
how is it?