Page 1 of 2

Reverse a Number

PostPosted: Tue Dec 21, 2010 11:51 am
by tunga.bhaskar
hello every body
i am developing a small application in COBOL
i have to get a reverse of given 3 digit number

NOTE:(REVERSE OF NUM WITHOUT USING ANY TEMP AND COBOL COMMNDS)

please reply me E-addr removed

Re: 2-file match/merge sample code

PostPosted: Tue Dec 21, 2010 1:46 pm
by enrico-sorichetti
what do You mean by REVERSE :
1) 12345 ==> -12345
2) 12345 ==> 54321

the question as posed just deserves the picky comment ...
this is an forum for professionals, no a puzzle solving one!
why should we waste waste time on something of little use !

also the question You ask is not related to the topic being discussed here,
learn to post things properly ( in this case start a new topic )
it will save for the moderators the work of making things right

Re: Reverse a Number

PostPosted: Wed Dec 22, 2010 12:33 am
by dick scherrer
Hello and welcome to the forum,

When you have a question, you should start a new topic for your question rather than posting a reply to some unrelated topic. . .

What do you mean by "reverse"?
NOTE:(REVERSE OF NUM WITHOUT USING ANY TEMP AND COBOL COMMNDS)
If you cannot use "commands" you cannot write code. Code is a series of commands. . .

Re: Reverse a Number

PostPosted: Wed Dec 22, 2010 12:35 am
by prino
tunga.bhaskar wrote:hello every body
i am developing a small application in COBOL
i have to get a reverse of given 3 digit number

NOTE:(REVERSE OF NUM WITHOUT USING ANY TEMP AND COBOL COMMNDS)[/size][/color]


In COBOL, but without any COBOL commands?

Maybe Krishna or any other divine entity of your liking can do this...

Re: Reverse a Number

PostPosted: Wed Dec 22, 2010 8:59 am
by dick scherrer
Hello,

Typically, to get help here, you need to post a reply and answer questions asked. . .

Re: Reverse a Number

PostPosted: Fri Jan 28, 2011 6:05 pm
by BillyBoyo
01 Thenumber.
     05  Thefirstcharacter PIC X.
     05  FILLER                 PIC X.
     05  Thelastcharacter  PIC X.

Put your three-digit number to be reversed into Thenumber.

Then your preferred conditional construct which says:

If Thefirstcharacter equals "1", put Thelastcharacter into Thefirstcharacter and put "1" into Thelastcharacter, otherwise if Thefirstcharacter equals "2", put Thelastcharacter into Thefirstcharacter and put "2" into Thelastcharacter, otherwise, etc

In the real world, should also validate that the original "number" is actually a number.
   


Can't think why you'd want to do this, except for homework. I think all the "big guys" on here are very patient, although having to make the same points repeatedly. Don't just ask for your homework to be done for you, have a go at it and if you get struck, show what you've done and explain the problem you have. Show what should happen to the data, and what does happen with your code.

Re: Reverse a Number

PostPosted: Sat Jan 29, 2011 1:13 am
by dick scherrer
Can't think why you'd want to do this, except for homework.
Yup, lots of what we do here is answer student homework questions.

This is one of the main reasons this forum was opened :)

d

Re: Reverse a Number

PostPosted: Sat Jan 29, 2011 5:29 am
by BillyBoyo
dick scherrer wrote:
Can't think why you'd want to do this, except for homework.
Yup, lots of what we do here is answer student homework questions.

This is one of the main reasons this forum was opened :)

d



Sorry about that, even though I now see it staring at me at the top of each screen, I didn't realise. Perhaps I was put off by other contributors to this thread (and other threads), with your graceful exception.

Re: Reverse a Number

PostPosted: Sat Jan 29, 2011 2:57 pm
by enrico-sorichetti
even considering the extenuating circumstance of the language barrier
too many people around here lack the basic skill of expressing clearly their needs...
or are they just lazy and careless ?

from my forum(s) experience, most often the second one applies!

Re: Reverse a Number

PostPosted: Sat Jan 29, 2011 4:32 pm
by BillyBoyo
I see your point well, so I've started some topics in the suggestions bit of the board.

I'm not trying to be personal about anyone, by the way, but I saw some comment about this board being for "professionals" or something. Kinda gave me the wrong end of the stick, that one.