|
|
back to boardDiscussion of Problem 1068. SumI am wrong ?? #include <iostream.h> int main(){ int num; while (cin>>num){ int answer=0; if(num>=1){ answer = num*(num+1)/2; printf("%d\n",answer); } else{ answer = (2-num)*(1+num)/2; printf("%d\n",answer); } } return 0; } where ? Re: I am wrong ?? i faced same problem. compiler may not support cin>> but istream::cin>> or u should use scanf("%d",&a); like this. thanks |
|
|