Answer to Question #293177 in C for RAMAKRISHNAN

Question #293177

monica has cooked n dishes and collected the data on the level of satisfaction for all the dishes from a guest. the guest returns an array, where the ith element of the array is the liking level of the ith dish. also, the time taken to cook the ith dish is i. like-to-time coefficient of a dish is calculated by multiplying the time taken to cook food with its liking level, i.e., input 2[i]. totally like-to-time coefficient is calculated by summing up all individual coefficients of dishes. you want the total like-to-time coefficient to be maximum. you can also remove some dishes, in which case, a new coefficient is calculated using the left dishes. find the maximum sum of all possible like-to-time coefficients.​

1
Expert's answer
2022-02-02T11:48:22-0500
#include <stdio.h>


int main()
{
    int dishes[10] = {};
    printf("Calculating the maximum level of satisfaction for 10 dishes if maximum coefficient is 10! =)\n");
    int total_like_to_time = 0;
    for (int i = 0; i != 10; ++i)
    {
        dishes[i] = 10;
        int like_to_time = 10 * i;
        total_like_to_time += like_to_time;
    }
    printf("Total like-to-time coefficient is %d\n", total_like_to_time);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS