Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are 77 levels used for?

1053


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

2408


Discuss about changing dataset name in proc.

1175


In COBOL, what is the different between index and subscript?

1188


What is the problem of ordered sequential files access?

1111


How do you define a variable of comp-1 and comp-2?

1138


Write a cobol program making use of the redefine clause.

1123


What is the utilization of copybook in cobol?

1117


How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?

1094


Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?

1062


How do you reference the following file formats from cobol programs?

1123


What is an in line perform? When would you use it? Anything else you wish to say about it.

1022


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

2256


Are you comfortable in cobol or jcl?

989


What is the difference between Call and a Link?

1123