Question

Calculate annual salary

08 Aug 2026
Answer :
Word Count : 1179
In C++, calculating annual salary is a simple but important programming problem that helps in understanding variables, data types, arithmetic operators, input, output, and basic program structure. Annual salary generally means the total amount of money an employee earns in one year. If the monthly salary of an employee is known, the annual salary can be calculated by multiplying the monthly salary by 12. The basic formula is: Annual Salary = Monthly Salary × 12 For example, if an employee receives a monthly salary of ₹25,000, the annual salary will be: Annual Salary = 25,000 × 12 Annual Salary = ₹3,00,000 In C++, this calculation can be performed using a variable for the monthly salary and another variable for the annual salary. The program takes the monthly salary as input from the user, multiplies it by 12, and displays the result. A simple C++ program for calculating annual salary is: ```cpp #include using namespace std; int main() { double monthlySalary, annualSalary; cout << "Enter monthly salary: "; cin >> monthlySalary; annualSalary = monthlySalary * 12; cout << "Annual Salary = " << annualSalary; return 0; } ``` In this program, `#include ` is used to provide input and output facilities. The `iostream` library contains objects such as `cin` and `cout`, which are commonly used for taking input and displaying output. The statement `using namespace std;` allows the program to use standard C++ objects such as `cout` and `cin` without writing `std::` before them. The `main()` function is the starting point of the C++ program. Program execution begins from this function. Two variables, `monthlySalary` and `annualSalary`, are declared using the `double` data type. The `double` data type is suitable for salary calculations because salary values may sometimes contain decimal values. For example, a monthly salary could be 28500.50. Using `double` allows such values to be stored accurately enough for normal salary calculations. The statement: ```cpp cout << "Enter monthly salary: "; ``` displays a message asking the user to enter the monthly salary. The statement: ```cpp cin >> monthlySalary; ``` takes the value entered by the user and stores it in the `monthlySalary` variable. The main calculation is performed by: ```cpp annualSalary = monthlySalary * 12; ``` Here, the multiplication operator `*` is used. The monthly salary is multiplied by 12 because there are twelve months in a year. The calculated value is stored in the `annualSalary` variable. Finally: ```cpp cout << "Annual Salary = " << annualSalary; ``` displays the calculated annual salary on the screen. Suppose the user enters: ```text Enter monthly salary: 30000 ``` The calculation performed by the program will be: ```text
_______ ________ _____ _________ ____ _____ _______ _________ ______ ____.
_____ _________ ____ ________ ______ __________ _________ _______ _______ ____ _____.
____ ________ _____ _____ ______ ________ ____ ____ ___ _____.
______ ________ __________ ________ ___ _______ ____ ________ ___.
_______ ________ __________ __________ __________ _____ ________ _______.
_________ ____ ___ _____ ___ ________.
____ ______ _________ __________ ____ _________ _________ _________ _________ _____.
___ _________ _________ _______ __________ _________.
__________ ____ _____ _________ ______ _______ ___.
_____ ___ ______ ______ ___.
________ ________ ____ ___ _____.
____ ______ __________ ____ ______ __________.
____ _________ _____ _____ __________ _____ ______ ________ ___.
_______ __________ ________ _____ ___ ________ ________.
__________ _______ __________ ____ ____ ______ __________ __________ _____ _________ _______.
___ ____ _________ _____ ___ ________ ______ ________ _______.
__________ ____ ____ ____ ________ ___ _______.
________ ________ ______ ____ ___ _________ ____ ______.
____ ______ _________ ___ ______ _____.
_____ __________ _______ ________ ______ ________ __________ ________ _______ ________ _____ __________.
_________ ________ __________ __________ ___ _____ ____ _______ ______ __________.
____ __________ __________ ___ ____ _______ __________ ________.
_____ _______ ______ _____ _______ ______ _________.
______ ____ _____ _______ ____ __________ ________ _______ ____ _________ ______.
________ ___ ________ ________ _____ _______.
___ _______ __________ _______ ________ ________ _______.
________ __________ ________ __________ ______ ____.
__________ ________ __________ ________ _________ _______ __________ ____.
____ __________ _________ _____ _________ _________.
____ ____ __________ ____ ____.
_________ _______ ____ _____ ________ ___ ___ ________ _______ ________ _____.
_______ ________ _________ _____ _________.
_______ _________ ________ _________ ________ _____ _____ _______ _______ __________ _______.
______ ______ __________ ___ ___ __________.
________ _______ ___ ________ ______ _____ ___ _______ _________ _____.
__________ _____ __________ ______ ____ ____ ______ ________ ______ _________.
______ __________ _______ _______ ______.
_____ ________ ____ _________ ________ __________ _____ ___ _____.
______ ____ ________ _______ _________ __________ __________ ____ ________ __________.
___ ___ _____ ______ ________ ___ ______ ________ ______.
___ ___ ________ _________ _______ ____.
_____ ____ ___ ____ ____ ___ ________ _____ ___ __________.
_________ _______ _____ _______ ___ ______ _______.
_____ ____ _________ ____ _____ ____.
____ __________ _____ ________ ____ ______ ________ ___ ______ _____.
________ ____ _____ ____ ___ ______ ___ ______ __________ __________ ________.
______ __________ __________ ________ _______ ____.
_________ ____ _________ ________ ____ _____ _____.
______ _________ _________ _________ _______ ________.
______ _________ ___ ______ ______ _______ ___ ___ __________ __________.
_____ ____ ______ ____ _______ __________ _______ ________.
_____ _________ ________ ______ _______ _________ ___ ___ ___.
____ _________ _____ ______ ____ ________.
_____ ______ __________ ___ _____ ___.
_________ ______ __________ ______ ______ ___ _________ _________ ____ _________ ___ _____.
_________ __________ ______ ___ ______ _______.
____ ___ _____ ____ ___.
________ ______ ______ _____ ________ ________ ______ _______ _______ ______ ________.
_________ _______ ______ _________ ________ _____ ______.
______ _______ ______ ___ _______ __________ _____ __________ _________ ______.
______ __________ _________ __________ _______ __________ _______ ____ ____ _________ ______ __________.
_________ ________ _________ ________ ____ _________ _______ _____ _________ ____.
________ ______ ____ _____ ________ ________ _________ ______ _______ ____ ______.
_____ ______ _________ ________ ____ _____ ____ ____ ________ _________.
___ ________ ________ _________ __________ __________ ____ ________ ______ ____ ____ _______.
__________ ______ ____ ____ _____ ______.
__________ ___ _________ ______ _______ _________ _____ ________.
___ ___ ____ ____ ____ ________ ___ ___ _______ ____ ____ ______.
_________ ___ _________ _________ __________ __________.
___ __________ ______ _________ ___ __________ ___ _____ ________ _______ ____.
____ ____ _______ ________ ____ ____.
______ ____ ___ ___ ___ _________ ______ _______ _______.
___ _______ ___ ___ _________ ____ ________.
_____ ______ _________ ____ ______ ____ ____ _____ ________ _____ _______.
__________ _______ ___ _____ ______ _____ ________ _____ ____ _________ _____.
__________ ____ ____ _______ _________ ___ _________ _________ _________ ________.
______ ___ ____ ___ ___ ______ _____ ____ ___ ______ __________ _________.
_________ ______ __________ ______ ________ ________ _______ _______ ____ _______ ____.
________ ____ _______ _________ ______.
________ _______ __________ ________ _________ _______.
_______ __________ _____ ___ __________ __________ ____ __________ _________.
_________ ________ _________ ___ __________ _______ _________.
______ _______ ____ ___ _______ ________.
__________ ___ _______ ____ ____ ___ _________ ______ ________ _____.
________ ______ _____ ______ ______ ________ ________ _______ ________ _________ ______ ___.
__________ _________ ____ ________ ____ _______ _____ ____ ________ __________ ________.
_________ ____ ___ ________ ___ __________.
_______ _____ ________ ____ ___ ________.
__________ _____ ______ ___ ____ ____ ________ _______ __________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU BCS 131 2026 2027 - Calculate annual salary | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→