Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for my first project

#include <bits/stdc++.h>
using namespace std;

int main(){
    string a,b; cin>>a>>b;
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());

    string c="";
    int carry=0;
    for(int i=0;i<max(a.size(),b.size())||carry;i++){
        int x=carry;
        if(i<a.size()) x+=a[i]-'0';
        if(i<b.size()) x+=b[i]-'0';
        c.push_back(char(x%10+'0'));
        carry=x/10;
    }

    reverse(c.begin(),c.end());
    cout<<c;
}

Built With

  • cpp
Share this project:

Updates

Submission history