Вопрос задан 05.05.2019 в 04:04. Предмет Информатика. Спрашивает Никифорова Вика.

Написать программу в паскале мясокомбинат получал 6 дней мясо. определить среднее арифметическое

количества мяса полученного за эти дни и найти количество дней когда мясокомбинат получал мяса меньше среднего арефметического
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Казанцева Александра.
Program pr; var a:array[1..6]of real; i,kol:integer; sr_ar:real; begin for i:=1 to 6  do begin readln(a[i]); sr_ar:=sr_ar+a[i]; end; sr_ar:=sr_ar/6; writeln(sr_ar); for i:=1 to 6 do begin if(a[i]<sr_ar) then kol:=kol+1; end; writeln(kol); end.
держи, п.с. везет вам, проги на дом писать задают), у нас практической части почти нет(
удачи!
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To write a program in Pascal to solve this problem, you can follow these steps:

1. Declare an array to store the amount of meat received each day for 6 days. 2. Prompt the user to enter the amount of meat received for each day and store it in the array. 3. Calculate the sum of all the elements in the array to find the total amount of meat received in 6 days. 4. Calculate the average by dividing the total amount of meat by 6. 5. Initialize a counter variable to keep track of the number of days when the meat received is less than the average. 6. Iterate through the array and check if each element is less than the average. If it is, increment the counter. 7. Display the average amount of meat received and the number of days when the meat received was less than the average.

Here's an example program in Pascal that implements the above steps:

```pascal program MeatAverage;

var meatReceived: array[1..6] of Integer; totalMeat, average: Real; daysBelowAverage: Integer; i: Integer;

begin totalMeat := 0; daysBelowAverage := 0;

// Input the amount of meat received for each day for i := 1 to 6 do begin Write('Enter the amount of meat received on day ', i, ': '); Readln(meatReceived[i]); totalMeat := totalMeat + meatReceived[i]; end;

// Calculate the average average := totalMeat / 6;

// Count the number of days when the meat received is less than the average for i := 1 to 6 do begin if meatReceived[i] < average then daysBelowAverage := daysBelowAverage + 1; end;

// Output the average and the number of days below average Writeln('Average amount of meat received: ', average:0:2); Writeln('Number of days when meat received was below average: ', daysBelowAverage); end. ```

This program prompts the user to enter the amount of meat received for each day, calculates the average, and counts the number of days when the meat received was below the average. Finally, it displays the average amount of meat received and the number of days below average.

Please note that this program assumes the user will enter valid input for the amount of meat received each day.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос