input:- 12233344445555566666...
output:- 1=1,2=4,3=9...
Here firstno i.e 1 should be displayed and after that the
alikeno.s should be added n displayed.i.e 2+2=4 like tat it
goeson.
Answer / veena (ibm)
identification division.
program-id. calculationprg.
data division.
working-storage section.
01 ws-num.
02 ws-num1 occurs n times.
03 ws-num2 pic 9(2).
01 ws-result.
02 ws-result1 occurs n times.
03 ws-result2 pic 9(2).
01 ws-calc.
02 ws-calc1 occurs n times.
03 ws-calc2 pic 9(2).
03 ws-times pic 9(2).
05 n pic 9(2) val zero.
05 ws-count pic 9(2).
05 ws-num3 pic 9(2).
Procedure division.
display 'enter the length of number you want to input'
accept n.
display 'enter the input'
perform n times
accept ws-num2(ws-count)
display 'enter next number'
ws-count = ws-count+1
end-perform.
initialise ws-count.
perform n times
ws-count = ws-count + 1
ws-num3 = ws-num2(ws-count)
if ws-calc2(ws-count) = ws-num3
ws-times(ws-count) = ws-times(ws-count) + 1
else
ws-calc2(ws-count) = ws-num3
ws-times(ws-count) = 1
end-perform.
initialise ws-count.
perform n times
ws-count = ws-count + 1
ws-result2(ws-count) = ws-calc2(ws-count) * ws-times(ws-
count)
end-perform.
initialise ws-count.
perform n times
ws-count = ws-count + 1
display ws-result2(ws-count)
end-perform.
similarly other calculation can be performed.
Is This Answer Correct ? | 0 Yes | 3 No |
When the working storage variables get allocated? a.At Compile time b.At starting of the run time c.At end of the run time. d.None of these
Suppose i have a Cobol field of 10 byte. it contains a decimal sign.How to know where is the point location?
What is an explicit scope terminator?
perform I from 0 by 1 until I=5?How maney times it will executes
What are the pertinent COBOL
can we declare s9(9)v9(9) in cobol ? if yes how many bytes it will occupy ?(urgent plz answer it)
I want ALL ERROR codes in VSAM
3 Answers American Express, TCS,
how will you define vsam file in select clause?
Is It Possible to Update or change in VIEW Mode?
Which is not true about evaluate statement
I have the requirement to compare the two files and pick up the matching records. File 1. file2 23 32 32 13 34 15 35 36 36 35 43 Get the matching records from this 2 files to out file. how you will do this in cobol program?
15 Answers ADP, Broadridge, CTS, HSBC, L&T, RBS, TCS,
what is difference between the sysabend and userabend?