English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

The list is terminated by 0, which is not multiplied. For example the value of
prod(3,6,2,0) is 36 There is one named parameter,the first integer to be multiplied. It is assumed to be non zero.

2006-11-02 22:13:35 · 2 answers · asked by tyshea 1 in Computers & Internet Programming & Design

please help me out guys.. the language is C

2006-11-03 05:18:21 · update #1

2 answers

If I remember my C it would look like this:

long mult(int *nums) {
long sum = *nums;
do {
nums++; // increment the pointer
if ( (*nums)==0 ) {
break;
} else {
sum *= *nums;
}
while (1);

return sum;
}

2006-11-03 12:59:35 · answer #1 · answered by mchenryeddie 5 · 0 0

No "please" or "thank you"? Also, it'd be nice to know what language we're being commanded to write your program in...

Rawlyn.

2006-11-03 06:17:15 · answer #2 · answered by Anonymous · 0 1

fedest.com, questions and answers