Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PosMain {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double num = Double.parseDouble(scanner.nextLine()); //chislo i vuvejdane
- while(num>0){ // proverqva dali chisloto e positivno
- System.out.printf("%.2f", (num*2));
- num = Double.parseDouble(scanner.nextLine()); //otnovo vuvejdash chislo
- }
- System.out.println("Negative number!"); //sled kato e namerilo otricatelno - izpisva
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement