1 solutions

  • 0
    @ 2025-11-5 15:38:57

    C++ :

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        int x1,x2,ans;
        cin>>x1>>x2;
        if(x1<x2)
        {
            ans=x1+x2;
        }
        else if(x1>x2)
        {
            ans=x1-x2;
        }
        else
        {
            //相等
            ans=x1*x2;
        }
        cout<<ans<<endl;
        return 0;
    }
    

    Pascal :

    var
      a,b,m:longint;
    begin
      readln(a,b);
      if a<b then m:=a+b;
      if a>b then m:=a-b;
      if a=b then m:=a*b;
      writeln(m);
    end.
    
    • 1

    Information

    ID
    16999
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By