IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Looking for Ideas.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mounika Nemani

New User


Joined: 25 May 2018
Posts: 5
Location: India

PostPosted: Mon Jul 23, 2018 1:51 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Jul 23, 2018 3:05 pm
Reply with quote

the logic of an algorithm does NOT depend on the programming language!
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jul 23, 2018 3:08 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Ideas to motivate mainframe team All Other Mainframe Topics 5
No new posts File Contention Ideas (Batch & Fi... SYNCSORT 35
No new posts Db2 tools , missing feature , Ideas DB2 2
No new posts Share your ideas About Mainframe testing Testing & Performance 6
No new posts Kids' Ideas About Love General Talk & Fun Stuff 0
Search our Forums:

Back to Top