IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CAdvanced Functions ❯ Multiplication with Recursion
<06.08>
/* Problem: Write a function that multiplies two integers without using the multiplication (*) operator. */ #include <stdio.h> int multiply (int m, int n) { int answer; if (n == 1) answer = m; else answer = m + multiply (m, n-1); return (answer); } int main (void) { int a, b, c; a = 20; b = 10; c = multiply (a, b); printf("%d times %d is %d. \n", a, b, c); return(0); }
Hergestellt in Deutschland / Made in Germany
20 times 10 is 200.
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.