Sum of ten number using only two variable
unknown
c_cpp
3 years ago
278 B
4
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...