0 évaluation0% ont trouvé ce document utile (0 vote)
2 vues1 page
This Java program uses a while loop to calculate the sum of the first 20 odd numbers. It initializes an integer variable a to 1 and s to 0. In each iteration of the while loop, it adds the value of a to s, increments a by 2, and repeats until a is greater than 20. It then prints the final sum stored in s.
This Java program uses a while loop to calculate the sum of the first 20 odd numbers. It initializes an integer variable a to 1 and s to 0. In each iteration of the while loop, it adds the value of a to s, increments a by 2, and repeats until a is greater than 20. It then prints the final sum stored in s.
This Java program uses a while loop to calculate the sum of the first 20 odd numbers. It initializes an integer variable a to 1 and s to 0. In each iteration of the while loop, it adds the value of a to s, increments a by 2, and repeats until a is greater than 20. It then prints the final sum stored in s.