Question: we most use for loop like this (: Q3: Write a Java program to find the sum of positive numbers by using for loop. [Note:
we most use for loop like this (:Q3: Write a Java program to find the sum of positive numbers by using for loop. [Note: User has to enter positive numbers, when user entered a negative number it has to stop the loop and find the sum] Sample Output: Bluel: Terminal Window - Assignment1 Options Enter a number 2 Enter a number 3 Enter a number 5 Enter a number -20 Sum = 10 Can only enter input while your progra Code to Example 6: import java.util.Scanner; public class squarenumber { public static void main(String[] args) throws java.io.IOException { Scanner input = new Scanner(System.in); int number, square, counter; System.out.print("Enter up to which number you want square :: "); number = input.nextInt(); for(counter = 1; counter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
