• Дана таблица чисел, в этой таблице сложить числа в последней строке, ввод с клавиатуры, с++

    4 5 6 7
    0 0 0 0
    1 2 0 -4
    7 8 -1 7

    Должен вывести 7+8+(-1)+7=21

Ответы 3

  • #include using namespace std;int main(){ int arr[4][4], s=0; for (int i=0; i<4; ++i) for (int j=0; j<4; ++j) cin>>arr[i][j]; for (int i=0; i<4; ++i) s+=arr[3][i]; cout< if (arr[3][1]<0) cout<<"("< else cout< if (arr[3][2]<0) cout<<"("< else cout< if (arr[3][3]<0) cout<<"("< else cout<}
  • Здесь добавлен вывод вычислений
  • #include <iostream>

    using namespace std;

    int main(){

    int arr[4][4], s=0;

    for (int i=0; i<4; ++i)

     for (int j=0; j<4; ++j)

      cin>>arr[i][j];

    for (int i=0; i<4; ++i) s+=arr[3][i];

    cout<<s;

    }

    • Автор:

      toffee21
    • 6 лет назад
    • 0
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years