코 드 ¶
~cpp #include <iostream.h> void main() { int n=1; int sum=0; while (sum<=3000){ sum+=n; n++; } cout<<"n="<<n<<"sum="<<sum<<endl; }
~cpp #include <iostream.h> void main() { int n=1; int sum=0; while (sum<=3000){ sum+=n; n++; } cout<<"n="<<n<<"sum="<<sum<<endl; }