1 solutions

  • 0
    @ 2025-11-5 15:46:05

    C++ :

    #include<iostream>
    using namespace std;
    int main(){
        long long int sum,m,n;
            cin>>n>>m;
            sum=(n+m)*(m-n+1)/2;
            cout<<sum<<endl;
          
    	return 0;
    }
    

    Pascal :

    var
    a,b,s:longint;
    d:int64; 
    begin
    readln(a,b);
    for s:= a to b do
    d:=d+s;
    write(d);
    end.
    
    
    • 1

    Information

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