Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- //determins how high we count(2^degree)
- int degree=6;
- for(int i=0;i<=degree;i++)
- {
- //re initialize variables for 1 assension, dcension loop
- int value = 1; //stores the actual changeing numbers
- int valueCounter; //have a value that we can easily loop down through later
- for(valueCounter = 0; valueCounter<i;valueCounter++
- {
- cout<<value; //display the ascending numbers
- value *= 2; //multiply the current value by 2 and store it back again
- }
- //prevent a repeat of the max number and remove the last increase:
- value /= 4;
- for(valueCounter=(valueCounter-2);valueCounter>0;valueCounter--)
- {
- cout<<value;
- value /= 2; //divide down
- }
- }
- system("pause");
- retrun 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement