static int userInputSum(){ Scanner sc = new Scanner(System.in); int sum = 0; int num; do{ System.out.println("Enter the number: "); num = sc.nextInt(); System.out.println("Enter 0 to end the loop"); sum += num; }while (num > 0); System.out.println("Sum is "+ sum); return -1; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)