Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[]){
- int i, j, s_i = 0, s_p = 0, q_p = 0, q_i = 0, mat[2][2];
- cout << "Please four inputs: " << endl;
- for(i = 0; i < 2; i++){
- for(j = 0; j < 2; j++){
- cin >> mat[i][j];
- if(mat[i][j] % 2 == 0){
- q_p = q_p + 1;
- }
- else{
- q_i = q_i + 1;
- }
- }
- }
- cout << "\n" << endl;
- for(i = 0; i < 2; i++){
- for(j = 0; j < 2; j++){
- if(mat[i][j] % 2 == 0){
- s_p = s_p + mat[i][j];
- }
- else{
- s_i = s_i + mat[i][j];
- }
- }
- }
- if(mat[i] == mat[j]){
- cout << "i = j" << endl;
- }
- else{
- cout << "i != j" << endl;
- }
- cout << "Even sum: " << s_p << endl;
- cout << "Odd sum: " << s_i << endl;
- cout << "Even amount: " << q_p << endl;
- cout << "Odd amount: " << q_i << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement