by CodeChum Admin
Whole numbers are great, but I think we should also pay attention to decimal numbers, too.
So, how about we make a program that involves a lot of decimals?
Instructions:
package com.task;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc;
double sum = 0;
double current;
boolean isExit = false;
do {
System.out.println("Input decimal number");
sc = new Scanner(System.in);
current = sc.nextDouble();
sum = sum + current;
if (current < 0 || sum >= 100) {
isExit = true;
}
} while (!isExit);
}
}
Comments
Leave a comment