Output:
Click Here For Java Online Compiler
Solution:
*** Sum Of Natural Numbers Using FOR Loop *** For lOOp used !!! Sum of first 10 natural numbers is: 55
Click Here For Java Online Compiler
Solution:
public class SumNaturalForLoop { public static void main(String[] args) { int num = 10; // <------ How many numbers??? int count; int total = 0; for (count = 1; count <= num; count++) { total = total + count; } System.out.println("*** Sum Of Natural Numbers Using FOR Loop ***" + "\n"); System.out.println("For lOOp used !!!" + "\n"); System.out.println("Sum of first 10 natural numbers is: " + total); } }
comment 1 comments:
more_vertIs The Coin Casino Safe? | Casinoworld
28 January 2022 at 15:08Coin Casino is one of the most reputable 인카지노 and reputable gambling sites for kadangpintar cryptocurrencies. 1xbet Check out our review of their games, games, bonuses, security and
sentiment_satisfied Emoticon