Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ONE-DIMENSIONAL ARRAY
- Porquillo, Aljan A.
- */
- #include <iostream>
- using namespace std;
- int num[20], numcount = 1, x;
- int main(){
- cout << "THIS CODE IS TO REVERSE A 20 DIGIT NUMBER" << endl;
- for(int i = 1; i <= 20; i++){
- cout << "Enter number " << " #" << numcount++ << ": ";
- cin >> num[i];
- }
- for(x = 20; x >= 0; x--){
- if(num[x] == 0){
- continue;
- }
- cout << num[x];
- }
- }
- /* PSEUDO CODE:
- set array num with the buffer size of 20
- set varible numcount to use in looping numbers
- set variable x
- display title and the purpose of the program
- loop through each number then put
- in the array declared until it gets 20
- end loop
- loop variable x
- decrement until it gets 0
- if array has 0 and its true
- ignore (continue)
- display the array called num
- end program
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement