+ 1
write a program to find the product of all natural numbers up to 60
3 Answers
+ 12
just run a loop from a= 2 to 60 & initialize a variable prdct=1
//in loop write prdct*=a;
//ie , multiplying value of each natural no. in value of prdct
//print prdct after the loop
//now , u can make code by your own easily
+ 1
my bad. didnt see it was for Java.
int multiplicand, multiplier, productDos;
for (multiplicand = 0; multiplicand < 61; multiplicand++)
{
for (multiplier = 1; multiplier < 61; multiplier++)
{
productDos = multiplicand * multiplier;
System.out.println(" %1$x * %2$x = %3$x ",multiplicand,multiplier,productDos);
}
}
idk the formatting string in Java. maybe just %1x...