|
|
вернуться в форумWhat's wrong? Послано Fatum 13 ноя 2013 14:25 #include <iostream> using namespace std; int main(){
int a = 0; int b = 1; int c = 0; int k = 0;
cin >> a;
if(a > b){ k = 1;
for(; b <= a; b = b + k){
c += b;
}
}
else if(a < b){
k = -1;
for(; b >= a; b = b + k){
c += b;
}
}
cout << c; } |
|
|