Sum of ten number using only two variable

 avatar
unknown
c_cpp
2 years ago
278 B
3
Indexable
#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;
}
Editor is loading...