C++ Online Compiler
Example: FBR Income Tax Calculator (Simplified) in C++
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// FBR Income Tax Calculator (Simplified) #include <iostream> #include <iomanip> // For formatting output using namespace std; int main() { double annualIncome = 0; double taxPayable = 0; // Step 1: Get annual income from the user cout << "------------------------------------------" << endl; cout << " Simplified FBR Income Tax Calculator" << endl; cout << "------------------------------------------" << endl; cout << "Enter your annual income (PKR): "; cin >> annualIncome; // Step 2: Apply simplified FBR-like tax policy // Note: This policy is illustrative and NOT the actual FBR policy. // Consult official FBR sources for current tax rates. if (annualIncome <= 600000) { // Slab 1: Up to PKR 600,000 - 0% tax taxPayable = 0; } else if (annualIncome <= 1200000) { // Slab 2: PKR 600,001 to 1,200,000 - 2.5% on amount exceeding 600,000 taxPayable = (annualIncome - 600000) * 0.025; } else if (annualIncome <= 1800000) { // Slab 3: PKR 1,200,001 to 1,800,000 - PKR 15,000 + 12.5% on amount exceeding 1,200,000 taxPayable = 15000 + (annualIncome - 1200000) * 0.125; } else if (annualIncome <= 2500000) { // Slab 4: PKR 1,800,001 to 2,500,000 - PKR 90,000 + 20% on amount exceeding 1,800,000 taxPayable = 90000 + (annualIncome - 1800000) * 0.20; } else if (annualIncome <= 3500000) { // Slab 5: PKR 2,500,001 to 3,500,000 - PKR 230,000 + 25% on amount exceeding 2,500,000 taxPayable = 230000 + (annualIncome - 2500000) * 0.25; } else { // Slab 6: Above PKR 3,500,000 - PKR 480,000 + 30% on amount exceeding 3,500,000 taxPayable = 480000 + (annualIncome - 3500000) * 0.30; } // Step 3: Display the calculated tax cout << fixed << setprecision(2); // Format output to 2 decimal places cout << "------------------------------------------" << endl; cout << "Your annual income: PKR " << annualIncome << endl; cout << "Tax payable: PKR " << taxPayable << endl; cout << "------------------------------------------" << endl; return 0; }
Output
Clear
ADVERTISEMENTS