?
=?iso-8859-1?q?Eirik_Wix=F8e_Svela?=
How can I create a function that multiplicates x with x y times?
Eirik Wixøe Svela said:How can I create a function that multiplicates x with x y times?
Eirik said:How can I create a function that multiplicates x with x y times?
Eirik said:How can I create a function that multiplicates x with x y times?
If y is a positive integer, simply use a for loop.Eirik Wixøe Svela said:How can I create a function that multiplicates x with x y times?
Eirik said:How can I create a function that multiplicates x with x y times?
int pow(int x, unsigned int y) {
return (0 < y)? (1 < y)? (pow(x, y/2)*pow(x, y - y/2): x): 1;
}
int pow(int x, unsigned int y) {
return (0 < y)? (1 < y)? (pow(x, y/2)*pow(x, y - y/2): x): 1;
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.