Вопрос задан 04.11.2023 в 10:37. Предмет Информатика. Спрашивает Зонова Виктория.

Айдын, Санжар и Аскар отправились на рыбалку. Количество выловленных рыб – k,l,m соответственно.

Если друзья разделят выловленную рыбу поровну, сколько рыб достанется каждому и сколько останется? Разработай программу. СРОЧНО ПОМОГИИЕ ДАМ 20 БАЛЛОВ
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Малофеева Виктория.

Ответ:

#include<iostream>

using namespace std;

int main()

{

setlocale(LC_ALL,"rus");

int a,b , c;

cin>>a>>b>>c;

if ((a+b+c)%3==0)

{

cout<<"Каждому достанется "<<(a+b+c)/3<<endl;

cout<<"Останеться 0";

}

else

{

div_t n;

n=div(a+b+c,3);

cout<<"Каждому достанется "<<n.quot<<endl;

cout<<"Останеться "<<(a+b+c)%3;

}

}

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To solve this problem, we need to find out how many fish each person will get and how many will be left over. Let's assume that the number of fish caught by Aydin, Sanjar, and Askar are represented by the variables k, l, and m, respectively.

To find out how many fish each person will get, we need to divide the total number of fish by the number of people. In this case, there are three people: Aydin, Sanjar, and Askar.

The formula to calculate the number of fish each person will get is:

Number of fish per person = (k + l + m) / 3

To find out how many fish will be left over, we need to calculate the remainder when the total number of fish is divided by the number of people. The formula to calculate the number of fish left over is:

Number of fish left over = (k + l + m) % 3

Now, let's develop a program to solve this problem in Python:

```python def calculate_fish_distribution(k, l, m): total_fish = k + l + m fish_per_person = total_fish // 3 fish_left_over = total_fish % 3

return fish_per_person, fish_left_over

# Example usage k = 10 l = 15 m = 20

fish_per_person, fish_left_over = calculate_fish_distribution(k, l, m)

print("Each person will get", fish_per_person, "fish.") print("There will be", fish_left_over, "fish left over.") ```

In this example, we assume that Aydin caught 10 fish, Sanjar caught 15 fish, and Askar caught 20 fish. The program will calculate that each person will get 15 fish, and there will be 0 fish left over.

Please note that this program assumes that the number of fish caught by each person is an integer value. If the number of fish caught can be a decimal, you may need to modify the program accordingly.

0 0

Похожие вопросы

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

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

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