Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- using namespace std;
- int main()
- {
- stack<int> first;
- int toplam,i,limit;
- toplam=0;
- cout<<"max sayi:";
- cin>>limit;
- for(int i=0;i<=limit;i++)
- {
- first.push(i);
- }
- while(!first.empty())
- {
- int z = (int) first.top();
- toplam = toplam+z;
- first.pop();
- }
- cout << "toplam :"<<toplam << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment