Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Multiplyby2 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double num = Double.MAX_VALUE;
- while (num>0){
- double num2 = Double.parseDouble(scan.nextLine());
- num++;
- if (num2<0){
- break;
- }
- System.out.printf("Result: %.2f%n",num2*2);
- }
- System.out.println("Negative number!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment