Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define MAX 32
- int n, v[MAX], i, cat,t;
- int main()
- {
- cout << "n= ";
- cin >> n;
- t=n;
- v[0] = v[1] = 1;
- while(n != 0) // Cat timp mai avem de inmultit
- {
- i = 1;
- cat = 0; // Initializam "cat" si "i"
- while(i <= v[0] || cat != 0)
- {
- v[i] = v[i] * 2 + cat;
- cat = v[i] / 10;
- v[i] %= 10;
- v[0] = max(v[0], i);
- i++;
- }
- n--;
- }
- cout << "2^"<<t<<"=";
- for(i = v[0]; i >= 1; i--)
- {
- cout << v[i];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement