Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the function that require below with C language, need it fast, One day, CYLL found an interesting piece of commercial from newspaper: the

Please write the function that require below with C language, need it fast,

image text in transcribedimage text in transcribed

One day, CYLL found an interesting piece of commercial from newspaper: the Cyber- restaurant was offering a kind of "Lunch Special" which was said that one could "buy one get two for free". That is, if you buy one of the dishes on their menu, denoted by d; with price Pi, you may get the two neighboring dishes di1 and d;+1 for free! If you pick up d, then you may get d2 and the last one dy for free, and if you choose the last one dn, you may get dn-1 and d for free. However, after investigation CYLL realized that there was no free lunch at all. The price Pi of the 2-th dish was actually calculated by adding up twice the cost c; of the dish and half of the costs of the two "free" dishes. Now given all the prices on the menu, you are asked to help CYLL find the cost of each of the dishes. Format of function: void Price int n, double pl] ); where int n satisfies that 2 #define Max_size 10000 /* max number of dishes */ void Price int n, double pl] ); int main() { int n, i; double p [Max_size]; scanf("%d", &n); for (i=0; i<>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

Students also viewed these Databases questions