0
Product of odd numbers from 1 to 15...its where am stuck my outputs are 1 3 5 7 9 11 13
int x=1 while(x<15) { Console.WriteLine(x); x+=2;
7 Respostas
+ 1
If you want the product:
int x = 1;
int temp = 1;
while(x<16)
{
temp = temp * x ;
x += 2;
}
console.writeln(temp);
+ 1
I actually wanted him/her to figure it out on his/her own, the learn effect is greater in such a case.
But ok
0
want single number
0
x<=15
if 15 should be included
use another additional variable, were you compute the product
prod = prod*x
0
where do i insert the prod
0
Abigael Irene Nyangasi Before the loop after 'x' declaration. You have to set it to 1
int prod= 1;
so you can repeat multiplication in loop
0
Am a begginer in this