Mehul Bansal 20BCE1220
Mehul Bansal 20BCE1220
Implement the program to calculate the total profit made for the day from the sale of these
drinks.
#include<stdio.h>
int main()
{
int start[2][3];
int end[2][3];
printf("At the Start of the day\n");
printf("Brand C\n");
printf("Small: ");
scanf("%d",&start[0][0]);
printf("Medium: ");
scanf("%d",&start[0][1]);
printf("Large: ");
scanf("%d",&start[0][2]);
printf("Brand P\n");
printf("Small: ");
scanf("%d",&start[1][0]);
printf("Medium: ");
scanf("%d",&start[1][1]);
printf("Large: ");
scanf("%d",&start[1][2]);
printf("At the end of the day\n");
printf("Brand C\n");
printf("Small: ");
scanf("%d",&end[0][0]);
printf("Medium: ");
scanf("%d",&end[0][1]);
printf("Large: ");
scanf("%d",&end[0][2]);
printf("Brand P\n");
printf("Small: ");
scanf("%d",&end[1][0]);
printf("Medium: ");
scanf("%d",&end[1][1]);
printf("Large: ");
scanf("%d",&end[1][2]);
float profit[3];
printf("Profit per cup\n");
printf("Small: ");
scanf("%f",&profit[0]);
printf("Medium: ");
scanf("%f",&profit[1]);
printf("Large: ");
scanf("%f",&profit[2]);
double profit_small;
double profit_medium;
double profit_large;
double total_profit;
profit_small=(double)((start[0][0]+start[1][0]-end[0][0]-
end[1][0])*profit[0]);
profit_medium=(double)((start[0][1]+start[1][1]-end[0][1]-
end[1][1])*profit[1]);
profit_large=(double)((start[0][2]+start[1][2]-end[0][2]-
end[1][2])*profit[2]);
printf("Total profit from Small: %.2f\n", profit_small);
printf("Total profit from Medium: %.2f\n", profit_medium);
printf("Total profit from Large: %.2f\n", profit_large);
total_profit=profit_large+profit_medium+profit_small;
printf("Total Profit: %.2f\n", total_profit);
}