If an employee spends 30% of his salary on fooding, 10% on clothing and 15% on other work. In this way he saves 10000 per month. Write a c program to find his total salary.










#include<stdio.h>
int main(){
    float total_salary;
    total_salary = 10000.0/(1-30.0/100-10.0/1000.0-15.0/100);
    printf("%f",total_salary);
    return 0;
}





Alogrithm:

//Spending money on fooding
        fooding = (total_salary * 30)/100;
        //Spending on clothing
        clothing = (total_salary*10)/100;
        //spending on other work
        other = (total_salary*15)/100;
        //According to question
        total_salary = fooding + clothing + other + 10000
        total_salary = (total_salary * 30)/100 + (total_salary*10)/100 + (total_salary*15)/100 + 10000
        total_salary(1 -30/100 - 10/100 - 15/100) = 10000
        total_salary = 10000/(1-30/100-10/1000-15/100)

Answer: 18518.517578







Post a Comment