Tổng và tích

View as PDF

Time limit: 1.0s , Memory limit: 64M , Points: 1 (partial)

Cho hai số nguyên có bốn chữ số mn, ký hiệu m = \overline {abcd} n = \overline {efgh}. Viết chương trình tính S = d + h, P = a \times e.

Input

Dòng duy nhất chứa hai số nguyên có bốn chữ số m, n.

Output

Dòng thứ nhất in số S.

Dòng thứ hai in số P

Samples

Sample Input 1
2345 9876
Sample Output 1
11
18
Sample Input 2
1223 3453
Sample Output 2
6
3

Comments


  • 0
    25T1020086  commented on Oct. 7, 2025, 8:24 a.m.

    include <iostream>

    using namespace std;

    int main() { int m, n; cin >> m >> n;

    int a = m / 1000;
    int d = m % 10;
    int e = n / 1000;
    int h = n % 10;
    
    int S = d + h;
    int P = a * e;
    
    cout << S << endl;
    cout << P << endl;
    
    return 0;

    }


    • 0
      25T1020454  commented on Sept. 25, 2025, 2:08 a.m.

      sample output 2 co tin hieu var


        • 0
          Testct  commented on Sept. 25, 2025, 6:45 a.m.

          À thế à


        • 0
          hacker  commented on Sept. 13, 2025, 8:50 a.m.

          Ez


          • 1
            Dang2  commented on April 28, 2025, 1:35 p.m.

            Easy


            • 0
              23t1110006  commented on March 21, 2024, 3:46 a.m.

              hello everyone


              • 0
                23T1020192  commented on Oct. 28, 2023, 6:15 a.m.

                cho e xin cách giải bài này với ạ


                  • 0
                    23t1110006  commented on March 21, 2024, 3:46 a.m.


                    • 0
                      tocdovodoi  commented on Feb. 26, 2024, 5:36 a.m.

                      đổi qua chuỗi rồi dùng index mà cộng với nhân bạn


                      • 0
                        23T1020633  commented on Oct. 29, 2023, 4:45 p.m. edited

                        Mấu chốt:a=m/1000; e=n/1000; d=(m%100)%10; h=(n%100)%10; rồi đó, bạn tự code nha