import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int input = 0;
int sum = 0;
do {
System.out.print("Enter number: ");
input = scanner.nextInt();
if (input > 100) {
System.out.println("his number is already more than 100");
break;
}
if (sum + input <= 100)
sum += input;
} while (sum < 100);
System.out.println("Sum of Numbers : " + sum);
}
}
Comments
Leave a comment