Question:
How do you print a percent sign "%" using printf?
Answer:
Escaped percent sign is double percent (%%)
Code:
public class PrintPercentSign { public static void main(String[] args) { System.out.printf("4 out of 10 is %d%% \n", 40); } }
Output:
$ java PrintPercentSign 4 out of 10 is 40%