Identification Division.
Program-ID. reverse.
Environment Division.
Data Division.
Working-Storage Section.
77 N PIC 9(6).
77 Temp PIC 9(6).
77 Rem PIC 9.
77 Rev PIC 9(6) Value Zeros.
Procedure division.
Main-Para.
Display "Enter Number (Maximum 6 digits) : ".
Accept N.
Move N TO Temp.
Perform Para-1 Until N = 0.
Display "Reverse of " Temp " is " Rev.
Stop Run.
Para-1.
Divide N BY 10 Giving N Remainder Rem.
Compute Rev = Rev * 10 + Rem.
Can you please share the program to find the place value of a digit from left to right in cobol.
ReplyDelete