ilovelinux2006
Programmer
Hello everyone,
I created a simple program, and i noticed that printf is not skipping any lines. How do I have printf skip lines?? Below is the program:
import java.util.Scanner;
public class Testin {
public static void main(String[] args) {
double number = 5;
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
double special = input.nextDouble();
System.out.printf("This is the number with 3 decimals: %.3f", special);
System.out.printf(" This is the same number times 5: %.3f", special*number);
}
}
And here is the output:
Enter a number: 65
This is the number with 3 decimals: 65.000 This is the same number times 5: 325.000
(with println or print there would be 3 different lines, not 2) Please help!
I created a simple program, and i noticed that printf is not skipping any lines. How do I have printf skip lines?? Below is the program:
import java.util.Scanner;
public class Testin {
public static void main(String[] args) {
double number = 5;
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
double special = input.nextDouble();
System.out.printf("This is the number with 3 decimals: %.3f", special);
System.out.printf(" This is the same number times 5: %.3f", special*number);
}
}
And here is the output:
Enter a number: 65
This is the number with 3 decimals: 65.000 This is the same number times 5: 325.000
(with println or print there would be 3 different lines, not 2) Please help!