IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | 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 IHY PRESS Frankfurt am Main 60329 Deutschland