Dremendo Tag Line
t

Print 1 pen cost price in C++

cout - Question 14

In this question, we will see how to print the cost of one pen if the cost of 12 pens is Rs. 150 in C++ programming using the cout statement. To know more about cout statement click on the cout statement lesson.

Q14) Write a program in C++ to print the cost of one pen if the cost of 12 pens is Rs. 150.

Program

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    cout<<"Cost of 12 pens = Rs.150\n";
    cout<<"Cost of 1 pen = Rs."<<150/12.0;
    return 0;
}

Output

Cost of 12 pens = Rs.150
Cost of 1 pen = Rs.12.5
video-poster