编辑代码

#include <iostream>
using namespace std;
int main() {
    cout<<"Enter two numbers:"<<endl;
    int x,y,ans=0,z;
    cin>>x>>y;
    z=x;
    while (x>=y){
        ans += x;
        cout<<x<<endl;
        --x;
    }
    cout<<"The sum of "<<z<<" and "<<y<<" is "<<ans<<endl;
    return 0;
}