Sum of ten number using only two variable

mail@pastecode.io avatar
unknown
c_cpp
a year ago
278 B
1
Indexable
Never
#include<bits/stdc++.h>
using namespace std;

int main()
{

    pair<int, int> sum_and_count = {0, 10};
    

    while(sum_and_count.second--)
    {
        int x;
        cin>> x;

        sum_and_count.first += x;
    }

    cout<< sum_and_count.first<< endl;
    return 0;
}