Home
Source Codes
Engineering Colleges
Training Reports
Seminar Reports
Placement
Papers
Forums
Computer Science / IT
Electronics
Electrical
Mechanical
Chemical
Civil
CAT / MBA
GMAT / Foreign MBA
Latest Jobs
Engineering Jobs / Technical Jobs
Management Jobs
Sitemap
Terms of use
|
|
|
|
|
Displaying Source Code(s)
|
|
Program to display english-language equivalent of an i/p number.
--------------------------------------------------------------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID. Q11.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM PC.
OBJECT-COMPUTER. IBM PC.
INPUT-OUTPUT SECTION.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 NUM-FORMAT.
02 UNITS PIC X(6) VALUE SPACES.
02 TENS PIC X(9) VALUE SPACES.
02 HUNDREDS PIC X(15) VALUE SPACES.
02 THOUSANDS PIC X(15) VALUE SPACES.
02 TEN-THOUSANDS PIC X(10) VALUE SPACES.
02 LAKHS PIC X(15) VALUE SPACES.
02 TEN-LAKHS PIC X(10) VALUE SPACES.
02 CRORES PIC X(15) VALUE SPACES.
* 02 DIGITS PIC X(15) OCCURS 8 TIMES.
77 NUM PIC 9(8).
77 NUM1 PIC 9(8).
77 REM PIC 9.
77 REM1 PIC 9.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER ANY NUMBER UPTO 8 DIGITS"
ACCEPT NUM.
MOVE NUM TO NUM1.
PERFORM CONVERTER-PARA.
EXIT-PARA.
STOP RUN.
CONVERTER-PARA.
COMPUTE REM = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 / 10 .
COMPUTE REM1 = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 /10 .
IF REM1 = 1
IF REM =0
MOVE "TEN" TO TENS
ELSE IF REM = 1
MOVE "ELEVEN" TO TENS
ELSE IF REM = 2
MOVE "TWELVE" TO TENS
ELSE IF REM = 3
MOVE "THIRTEEN" TO TENS
ELSE IF REM= 4
MOVE "FOURTEEN" TO TENS
ELSE IF REM = 5
MOVE "FIFTEEN" TO TENS
ELSE IF REM = 6
MOVE "SIXTEEN" TO TENS
ELSE IF REM = 7
MOVE "SEVENTEEN" TO TENS
ELSE IF REM= 8
MOVE "EIGHTEEN" TO TENS
ELSE IF REM = 9
MOVE "NINETEEN" TO TENS
ELSE
ELSE
IF REM = 0
MOVE "ZERO" TO UNITS
ELSE IF REM = 1
MOVE "ONE" TO UNITS
ELSE IF REM = 2
MOVE "TWO" TO UNITS
ELSE IF REM = 3
MOVE "THREE" TO UNITS
ELSE IF REM = 4
MOVE "FOUR" TO UNITS
ELSE IF REM = 5
MOVE "FIVE" TO UNITS
ELSE IF REM = 6
MOVE "SIX" TO UNITS
ELSE IF REM = 7
MOVE "SEVEN" TO UNITS
ELSE IF REM = 8
MOVE "EIGHT" TO UNITS
ELSE IF REM = 9
MOVE "NINE" TO UNITS.
IF REM1 = 2
MOVE "TWENTY" TO TENS
ELSE IF REM1 = 3
MOVE "THIRTY" TO TENS
ELSE IF REM1 = 4
MOVE "FOURTY" TO TENS
ELSE IF REM1 = 5
MOVE "FIFTY" TO TENS
ELSE IF REM1 = 6
MOVE "SIXTY" TO TENS
ELSE IF REM1 = 7
MOVE "SEVENTY" TO TENS
ELSE IF REM1 = 8
MOVE "EIGHTTY" TO TENS
ELSE IF REM1 = 9
MOVE "NINETY" TO TENS.
IF NUM1 = 0
GO TO EXIT-PARA.
* FOR HUNDREDTH PLACE
COMPUTE REM = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 / 10 .
IF REM = 0
MOVE SPACES TO HUNDREDS
ELSE IF REM = 1
MOVE "ONE HUNDRED" TO HUNDREDS
ELSE IF REM = 2
MOVE "TWO HUNDRED" TO HUNDREDS
ELSE IF REM = 3
MOVE "THREE HUNDRED" TO HUNDREDS
ELSE IF REM = 4
MOVE "FOUR HUNDRED" TO HUNDREDS
ELSE IF REM = 5
MOVE "FIVE HUNDRED" TO HUNDREDS
ELSE IF REM = 6
MOVE "SIX HUNDRED" TO HUNDREDS
ELSE IF REM = 7
MOVE "SEVEN HUNDRED" TO HUNDREDS
ELSE IF REM = 8
MOVE "EIGHT HUNDRED" TO HUNDREDS
ELSE IF REM = 9
MOVE "NINE HUNDRED" TO HUNDREDS.
IF NUM1 = 0
GO TO EXIT-PARA.
COMPUTE REM = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 /10 .
COMPUTE REM1 = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 / 10 .
IF REM1 = 1
IF REM =0
MOVE "TEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 1
MOVE "ELEVEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 2
MOVE "TWELVE THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 3
MOVE "THIRTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM= 4
MOVE "FOURTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 5
MOVE "FIFTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 6
MOVE "SIXTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 7
MOVE "SEVENTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM= 8
MOVE "EIGHTEEN THOUSAND" TO TEN-THOUSANDS
ELSE IF REM = 9
MOVE "NINETEEN THOUSAND" TO TEN-THOUSANDS
ELSE
ELSE
IF REM = 1
MOVE "ONE THOUSAND" TO THOUSANDS
ELSE IF REM = 2
MOVE "TWO THOUSAND" TO THOUSANDS
ELSE IF REM = 3
MOVE "THREE THOUSAND" TO THOUSANDS
ELSE IF REM = 4
MOVE "FOUR THOUSAND" TO THOUSANDS
ELSE IF REM = 5
MOVE "FIVE THOUSAND" TO THOUSANDS
ELSE IF REM = 6
MOVE "SIX THOUSAND" TO THOUSANDS
ELSE IF REM = 7
MOVE "SEVEN THOUSAND" TO THOUSANDS
ELSE IF REM = 8
MOVE "EIGHT THOUSAND" TO THOUSANDS
ELSE IF REM = 9
MOVE "NINE THOUSAND" TO THOUSANDS.
IF REM1 = 2
MOVE "TWENTY" TO TENS
ELSE IF REM1 = 3
MOVE "THIRTY" TO TENS
ELSE IF REM1 = 4
MOVE "FOURTY" TO TENS
ELSE IF REM1 = 5
MOVE "FIFTY" TO TENS
ELSE IF REM1 = 6
MOVE "SIXTY" TO TENS
ELSE IF REM1 = 7
MOVE "SEVENTY" TO TENS
ELSE IF REM1 = 8
MOVE "EIGHTTY" TO TENS
ELSE IF REM1 = 9
MOVE "NINETY" TO TENS.
IF NUM1 = 0
GO TO EXIT-PARA.
COMPUTE REM = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 /10 .
COMPUTE REM1 = ( NUM1 / 10 ) * 10.
COMPUTE NUM1 = NUM1 / 10 .
IF REM1 = 1
IF REM =0
MOVE "TEN THOUSAND" TO TEN-LACS
ELSE IF REM = 1
MOVE "ELEVEN THOUSAND" TO TEN-LACS
ELSE IF REM = 2
MOVE "TWELVE THOUSAND" TO TEN-LACS
ELSE IF REM = 3
MOVE "THIRTEEN THOUSAND" TO TEN-LACS
ELSE IF REM= 4
MOVE "FOURTEEN THOUSAND" TO TEN-LACS
ELSE IF REM = 5
MOVE "FIFTEEN THOUSAND" TO TEN-LACS
ELSE IF REM = 6
MOVE "SIXTEEN THOUSAND" TO TEN-LACS
ELSE IF REM = 7
MOVE "SEVENTEEN THOUSAND" TO TEN-LACS
ELSE IF REM= 8
MOVE "EIGHTEEN THOUSAND" TO TEN-LACS
ELSE IF REM = 9
MOVE "NINETEEN THOUSAND" TO TEN-LACS
ELSE
ELSE
IF REM = 1
MOVE "ONE THOUSAND" TO LACS
ELSE IF REM = 2
MOVE "TWO THOUSAND" TO LACS
ELSE IF REM = 3
MOVE "THREE THOUSAND" TO LACS
ELSE IF REM = 4
MOVE "FOUR THOUSAND" TO LACS
ELSE IF REM = 5
MOVE "FIVE THOUSAND" TO LACS
ELSE IF REM = 6
MOVE "SIX THOUSAND" TO LACS
ELSE IF REM = 7
MOVE "SEVEN THOUSAND" TO LACS
ELSE IF REM = 8
MOVE "EIGHT THOUSAND" TO LACS
ELSE IF REM = 9
MOVE "NINE THOUSAND" TO LACS
IF REM1 = 2
MOVE "TWENTY" TO TENS
ELSE IF REM1 = 3
MOVE "THIRTY" TO TENS
ELSE IF REM1 = 4
MOVE "FOURTY" TO TENS
ELSE IF REM1 = 5
MOVE "FIFTY" TO TENS
ELSE IF REM1 = 6
MOVE "SIXTY" TO TENS
ELSE IF REM1 = 7
MOVE "SEVENTY" TO TENS
ELSE IF REM1 = 8
MOVE "EIGHTTY" TO TENS
ELSE IF REM1 = 9
MOVE "NINETY" TO TENS.
****************************************************************************
IF REM = 0 AND I > 1
MOVE "Y" TO EXIT1
GO TO EXIT-PARA.
IF I=2
IF REM = 1
MOVE SPACES TO DIGITS(1)
IF PREV-DIGIT = 0
MOVE "TEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 1
MOVE "ELEVEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 2
MOVE "TWELVE" TO DIGITS(I)
ELSE IF PREV-DIGIT = 3
MOVE "THIRTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 4
MOVE "FOURTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 5
MOVE "FIFTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 6
MOVE "SIXTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 7
MOVE "SEVENTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 8
MOVE "EIGHTEEN" TO DIGITS(I)
ELSE IF PREV-DIGIT = 9
MOVE "NINETEEN" TO DIGITS(I).
IF REM = 2 AND I =2
MOVE "TWENTY" TO DIGITS(I)
ELSE IF REM = 3
MOVE "THIRTY" TO DIGITS(I)
ELSE IF REM = 4
MOVE "FOURTY" TO DIGITS(I)
ELSE IF REM = 5
MOVE "FIFTY" TO DIGITS(I)
ELSE IF REM = 6
MOVE "SIXTY" TO DIGITS(I)
ELSE IF REM = 7
MOVE "SEVENTY" TO DIGITS(I)
ELSE IF REM = 8
MOVE "EIGHTTY" TO DIGITS(I)
ELSE IF REM = 9
MOVE "NINETY" TO DIGITS(I).
IF I IS = 1
IF REM = 0 AND I = 1
MOVE "ZERO" TO DIGITS(I)
ELSE IF REM = 1
MOVE "ONE" TO DIGITS(I)
ELSE IF REM = 2
MOVE "TWO" TO DIGITS(I)
ELSE IF REM = 3
MOVE "THREE" TO DIGITS(I)
ELSE IF REM = 4
MOVE "FOUR" TO DIGITS(I)
ELSE IF REM = 5
MOVE "FIVE" TO DIGITS(I)
ELSE IF REM = 6
MOVE "SIX" TO DIGITS(I)
ELSE IF REM = 7
MOVE "SEVEN" TO DIGITS(I)
ELSE IF REM = 8
MOVE "EIGHT" TO DIGITS(I)
ELSE IF REM = 9
MOVE "NINE" TO DIGITS(I).
IF I IS = 3
IF REM = 0
MOVE SPACES TO DIGITS(I)
ELSE IF REM = 1
MOVE "ONE HUNDRED" TO DIGITS(I)
ELSE IF REM = 2
MOVE "TWO HUNDRED" TO DIGITS(I)
ELSE IF REM = 3
MOVE "THREE HUNDRED" TO DIGITS(I)
ELSE IF REM = 4
MOVE "FOUR HUNDRED" TO DIGITS(I)
ELSE IF REM = 5
MOVE "FIVE HUNDRED" TO DIGITS(I)
ELSE IF REM = 6
MOVE "SIX HUNDRED" TO DIGITS(I)
ELSE IF REM = 7
MOVE "SEVEN HUNDRED" TO DIGITS(I)
ELSE IF REM = 8
MOVE "EIGHT HUNDRED" TO DIGITS(I)
ELSE IF REM = 9
MOVE "NINE HUNDRED" TO DIGITS(I).
DISPLAY DIGITS(I).
MOVE REM TO PREV-DIGIT.
ADD 1 TO I.
* 02 UNITS PIC X(6) VALUE SPACES.
* 02 TENS PIC X(9) VALUE SPACES.
* 02 HUNDREDS PIC X(15) VALUE SPACES.
* 02 THOUSANDS PIC X(15) VALUE SPACES.
* 02 TEN-THOUSANDS PIC X(10) VALUE SPACES.
* 02 LAKHS PIC X(15) VALUE SPACES.
* 02 TEN-LAKHS PIC X(10) VALUE SPACES.
* 02 CRORES PIC X(15) VALUE SPACES.
|
|
|
|
|
Contribute content or training
reports / feedback /
Comments
job placement
papers
All rights reserved © copyright
123ENG |
|