A metal bar is divided into 10 segments, each with its owntemperature. The ends
ID: 3614720 • Letter: A
Question
A metal bar is divided into 10 segments, each with its owntemperature. The ends of the bar are connected to heat sourceswhich keep their temperatures constant. Hence, temp[0] and temp[9]are always the same values. Assume initial temperature of the restof the segments is 0 degrees.After a short time nterval, the new temperaute of each middlesegment becomes the average of the old temperatures of the twoneighboring segments.
temp[] is initialized as
100.00 0.00 0.00 0.00 0.00 0.000.00 0.00 0.00 80.00
After one time step, temperatures will be
100.00 50.00 0.00 0.00 0.00 0.00 0.00 0.00 40.00 80.00
And again
100.00 50.00 25.00 0.00 0.00 0.00 0.00 20.00 40.00 80.00
etc. etc.
have user input temps for segment 0 and segment 9.
I have no idea how to keep some elements of the array at thesame value while averaging some of them . any hints??? thanks! willrate highest
Explanation / Answer
please rate - thanks #include #include # define SIZE 10 void updateTemp( float data[], int size, int i); int main (void) { float temp[SIZE]; int x=SIZE/2-1, i,j; printf("Enter temperature of segment 0: "); scanf("%f", &temp[0]); printf(" Enter temperature of segment 9: "); scanf("%f", &temp[SIZE-1]); for ( i = 1; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.