Answer to Question #47567 in C++ for krad
2014-10-05T09:10:57-04:00
3. Write a program which produces the given sequence nos. (in alternate arrangement descending ) using the three looping statements:
1,5,2,4,3,3,4,2,5,1
1
2014-10-13T03:52:21-0400
Solution. Code #include <iostream>
#include <string>
using namespace std
; int main
() { stringdirect
; stringinverse
; // Input
cin
>> direct
; inverse
= direct
; // Inversing
for ( int i
= 0
; i
< direct
. length
(); i
++) { inverse
[ i
] = direct
[ direct
. length
() - 1
- i
]; } // Output
cout
<< direct
<< ","
<< inverse
; return 0
; } Result 1,5,2,4,3
1,5,2,4,3,3,4,2,5,1
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment