Print 12 pens cost price in Java
Java Output - Question 13
In this question, we will see how to print the cost of 12 pens if the cost of one pen is Rs. 14 in java programming using the java output. To know more about java output click on the java output lesson.
Q13) Write a program in java to print the cost of 12 pens if the cost of one pen is Rs. 14.
Program
public class Q13
{
public static void main(String args[])
{
System.out.println("Cost of 1 pen = Rs.14");
System.out.print("Cost of 12 pens = Rs." + (12*14));
}
}
Output
Cost of 1 pen = Rs.14 Cost of 12 pens = Rs.168