Multicases Example




#include<stdio.h>
#include<conio.h>

void main()
{
    float prnibasichradapfnetsalabc;
    int choice;
    clrscr();
    
    printf("\n1. Interest \n2. netsal");
    printf("\nEnter the value of choice:\n");
    scanf("%d", &choice);
    
    switch(choice)
    {
        case 1:
        {
            printf("Enter the value P:\n");
            scanf("%f", &p);
            printf("Enter the value R:\n");
            scanf("%f", &r);
            printf("Enter the value N:\n");
            scanf("%f", &n);
                i = p*r*n/100;
            printf("Interest:: %f"i);
            break;
        }

        case 1:
        {
            printf("Enter the value of basic:\n");
            scanf("%f", &basic);
            printf("Enter the value of A:\n");
            scanf("%f", &a);
            printf("Enter the value of B:\n");
            scanf("%f", &b);
            printf("Enter the value of C:\n");
            scanf("%f", &c);
                hra = basic*a;
                da = basic*b;
                pf = basic*c;
                netsal = basic + hra + da + pf;
            printf("Net Salary:: %f"netsal);
            break;
        }

        default
        {
            printf("Invalid choice");
        }
    }
    getch();
}



Output:
1. Interest
2. netsal
Enter the value of choice:
1
Enter the value P:
1200
Enter the value R:
1.2
Enter the value N:
2
Interest:: 28.8