Total Expenses For The Event

Total Expenses For The Event 



Input Format:
The first input is an int value that corresponds to the branding expenses.
The second input is an int value that corresponds to the travel expenses.
The third input is an int value that corresponds to the food expenses.
The fourth input is an int value that corresponds to the logistics expenses.

Output Format:
The first line of the output should display the int value that corresponds to the total expenses for the Event.
The next four lines should display the percentage rate of each of the expenses.

Sample Input and Output:
Enter branding expenses
20000
Enter travel expenses
40000
Enter food expenses
15000
Enter logistics expenses
25000
Total expenses: Rs.100000.00
Branding expenses percentage: 20.00%
Travel expenses percentage: 40.00%
Food expenses percentage: 15.00%
Logistics expenses percentage: 25.00%

C Code:

#include<stdio.h>
int main()
{
    int b,t,f,l;
    float Total;
    float B,T,F,L;
    printf("Enter branding expenses\n");
    scanf("%d",&b);
    printf("Enter travel expenses\n");
    scanf("%d",&t);
    printf("Enter food expenses\n");
    scanf("%d",&f);
    printf("Enter logistics expenses\n");
    scanf("%d",&l);
    Total=b+t+f+l;
    printf("Total expenses : Rs.%.2f\n",Total);
    B=((b/Total)*100);
    printf("Branding expenses percentage : %.2f%%\n",B);
    T=((t/Total)*100);
    printf("Travel expenses percentage : %.2f%%\n",T);
    F=((f/Total)*100);
    printf("Food expenses percentage : %.2f%%\n",F);
    L=((l/Total)*100);
    printf("Logistics expenses percentage : %.2f%%\n",L);
    return 0;

}

Comments