Take a range and print all integer and it's sum

PHOTO EMBED

Fri Feb 10 2023 08:30:45 GMT+0000 (Coordinated Universal Time)

Saved by @itachi #c++

#include<iostream>
using namespace std;
int main(){
    int n;
    cout<<"Enter the range\n";
    cin>>n;
    int sum=0;
    for(int i=0;i<=n;i++){
        cout<<i<<" ";
        sum+=i;
    }cout<<endl;
    cout<<"The sum between given range is-> "<<sum<<endl;
    return 0;
}
content_copyCOPY