Income Tax Calculator (New Regime) Dry Run in C

Income Tax Calculator (New Regime) is an interactive C dry run visualizer from the If programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Income Tax Calculator (New Regime) Program Code

#include <stdio.h>
int main() {
    float annual_income, tax = 0;
    int is_senior_citizen;
    
    printf("Enter your annual income (in rupees): ");
    scanf("%f", &annual_income);
    printf("Are you a Senior Citizen (60+ years)? (1 for Yes, 0 for No): ");
    scanf("%d", &is_senior_citizen);
    
    if (is_senior_citizen == 1) {
        if (annual_income <= 300000) tax = 0;
        else if (annual_income <= 500000) tax = (annual_income - 300000) * 0.05;
        else if (annual_income <= 1000000) tax = 10000 + (annual_income - 500000) * 0.20;
        else tax = 110000 + (annual_income - 1000000) * 0.30;
    }
    else {
        if (annual_income <= 300000) tax = 0;
        else if (annual_income <= 600000) tax = (annual_income - 300000) * 0.05;
        else if (annual_income <= 900000) tax = 15000 + (annual_income - 600000) * 0.10;
        else if (annual_income <= 1200000) tax = 45000 + (annual_income - 900000) * 0.15;
        else if (annual_income <= 1500000) tax = 90000 + (annual_income - 1200000) * 0.20;
        else tax = 150000 + (annual_income - 1500000) * 0.30;
    }
    
    if ((!is_senior_citizen && annual_income <= 700000) || (is_senior_citizen && annual_income <= 700000)) {
        if (tax > 0) tax = 0;
        printf("\n Rebate under Section 87A applied (Tax NIL for income up to ₹7,00,000)\n");
    }
    
    float cess = tax * 0.04;
    float total_tax = tax + cess;
    
    printf("\n========================================\n");
    printf("    NEW TAX REGIME - TAX CALCULATION\n");
    printf("========================================\n");
    printf("Annual Income        : ₹%.2f\n", annual_income);
    printf("Income Tax (before cess): ₹%.2f\n", tax);
    printf("Health & Education Cess: ₹%.2f (4%%)\n", cess);
    printf("----------------------------------------\n");
    printf("TOTAL TAX PAYABLE     : ₹%.2f\n", total_tax);
    
    if (total_tax == 0) {
        printf("\n No tax payable under New Regime!\n");
    } else {
        printf("\nEffective Tax Rate   : %.2f%%\n", (total_tax / annual_income) * 100);
    }
    printf("========================================\n");
    
    return 0;
}

View the complete If programs page.

Program Console Income Tax Calculator (New Regime) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.