View previous topic :: View next topic
|
Author |
Message |
Mounika Nemani
New User
Joined: 25 May 2018 Posts: 5 Location: India
|
|
|
|
Hi,
This may be simple. pardon me for asking though..
I want to know different logical ways on how to code a cobol program(logic part) to achieve the below output in sysout.
Code: |
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5 |
Thanks
Mounika |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
the logic of an algorithm does NOT depend on the programming language! |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
If this is a "classroom" exercise then you should really join the beginners forum which is for newbies (to a subject) and students.
There are different ways to do this:
brute force:
Code: |
display 1
display 1 2
etc |
more sophisticated:
Code: |
initialise a table to 1, 2, etc
loop 1 to number of entries
loop 1 to current outer loop vcontrol value
display table item(inner loop control value)
end inner loop
end outer loop |
and other ways |
|
Back to top |
|
|
|