write a program to find the product of all natural numbers up to 60 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

write a program to find the product of all natural numbers up to 60

2nd Feb 2018, 3:17 AM
Sathi Bose
Sathi Bose - avatar
2 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
2nd Feb 2018, 8:22 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 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...
2nd Feb 2018, 6:29 AM
kideoh0jima