• Post Reply Bookmark Topic Watch Topic
  • New Topic

can anyone write this program in java like  RSS feed

 
harikrishnan venkatesan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need this program

First get n value..

ex:
n = 5 (like we get any number )
it contains 01234........

i need output like this under below..

0123
0124
1234
2340
3401

i need this program output.. like this..
asap can anyone send this logic in c 0r java language........

 
chris webster
Bartender
Posts: 2407
36
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone write the program? Sure. But why don't you do it?

Remember, JavaRanch is NotACodeMill so why not DoYourOwnHomework? You'll learn more that way!
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chris webster wrote:Can anyone write the program? Sure.

I'm not sure I could - at least not with a large degree of confidence that it is correct.
I would want a much better specification than what has been supplied - which is essentially just the expected output from one single input.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harikrishnan venkatesan wrote:i need this program output.. like this..

And before you can write a program (in any langauge) to do it, you need to describe, in detail, what "like this" means.

Programming is nothing more than understanding a problem; and don't write a line of code (in any language) until you do.

Winston
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harikrishnan venkatesan wrote:n = 5 (like we get any number )
it contains 01234........

How does the number 5 'contain' 01234.....'?
harikrishnan venkatesan wrote:
i need output like this under below..

0123
0124
1234
2340
3401

If you need those five literal outputs, just do 5 "System.out.println()" statements, with those literals.

Or do you mean you need to programatically determine something? And if so, please explain, IN DETAIL, what you need done. Simply showing an example of what to do in one case does not help us understand what you really need.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:If you need those five literal outputs, just do 5 "System.out.println()" statements, with those literals.


, fred. I went to college with a guy who took a final exam including a question calling for code to print the first ten rows of Pascal's triangle. He used your method, since his programming skills had never been very good. Being a last-semester senior, failure meant quite a bit. A couple of us went to bat for him and the professor grudgingly gave him credit for it, since the question called for a program that would "print" the result, not necessarily "compute" it.

To the question at hand: A persistent problem with books on programming languages is that many of them don't have indexes that let you look up non-alphameric (or even non-alphabetic) characters. No Java programmer should overlook the fine two-volume reference set, "Core Java." But even that doesn't have any non-alphabetics in its Volume I index (and the non-alphamerics in its more-advanced Volume II include a shockingly abstruse reference for the "%" character). So, while there are any number of ways to solve harikrishnan's problem, I would at least suggest he look up the "modulus" operator (implemented in Java, C, C++, and every other language in the current family that quietly copies C's basic syntax, with the "%" character). That ought to give you a lead on at least one way to compute your result.

Good luck.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stevens Miller wrote:I would at least suggest he look up the "modulus" operator (implemented in Java, C, C++, and every other language in the current family that quietly copies C's basic syntax, with the "%" character). That ought to give you a lead on at least one way to compute your result.

Are you a teacher perchance?

Winston
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Stevens Miller wrote:I would at least suggest he look up the "modulus" operator...

Are you a teacher perchance?


Heh. Hardly. I'm everyone's worst nightmare come true: an American lawyer who writes computer programs. That means I can run off at the mouth (or the keyboard) about coding minutiae until the next Ice Age (don't get me started on where the opening curly bracket is supposed to go...).

Yourself?
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stevens Miller wrote:Hardly. I'm everyone's worst nightmare come true: an American lawyer who writes computer programs...

Aaargh. Law And Coder. I can see it on NBC's 2014 lineup already....

Winston
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stevens Miller wrote:Yourself?

35-year vet with fairly standard COBOL→PL/1→C→C++→Java progression - with a few funky stops and sidelines in between.

So, pretty boring by comparison.

Winston
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stevens Miller wrote:, fred. I went to college with a guy who took a final exam including a question calling for code to print the first ten rows of Pascal's triangle. He used your method, since his programming skills had never been very good. Being a last-semester senior, failure meant quite a bit. A couple of us went to bat for him and the professor grudgingly gave him credit for it, since the question called for a program that would "print" the result, not necessarily "compute" it.

My wife, an American Lawyer, made up business cards for me that say "Fred Rosenberger - Didactic Literalist". She was going to say "pedantic literalist", but thought it too pejorative.

She also had a baseball hat for me that says "Captain Literal".

The point I was trying to subtly make was that an EXAMPLE does not constitute a SPEC. Sure, it helps, but it is far from complete. I am hoping the OP can come back and tell us what they really want.
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:I am hoping the OP can come back and tell us what they really want.

Based on a look at his previous posts, I wouldn't hold your breath.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:My wife, an American Lawyer, made up business cards for me that say "Fred Rosenberger - Didactic Literalist"

Ooof. Wonderful word that: "didactic"; you never know if it's an insult or a compliment. Sounds good too. +1 for your wife.

Winston
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Stevens Miller wrote:Hardly. I'm everyone's worst nightmare come true: an American lawyer who writes computer programs...

Aaargh. Law And Coder. I can see it on NBC's 2014 lineup already....


Another good one. I kind of got my start as a computer lawyer when I assisted on a mildly famous case at the end of the 1990's. My wife was a Law & Order fan at the time. Can you imagine how it felt to be working the biggest press case in New York at the time, only to come home and see her watching made-up cases on TV? I ended up calling that show, "Long & Boring." (Although, to be fair, I got a kick out of it while I was in law school, which I attended in New York city.)

I went to law school to get out of the computer business. Little did I know, then, that once the computer business has sunk its steely claws into your soft pink hide, it simply does not let go. Hence, I mostly make my living now as a consultant to other lawyers who need someone to help them cope with computer-based evidence (mostly e-mail and the like).

Winston Gutkowski wrote:35-year vet with fairly standard COBOL→PL/1→C→C++→Java progression - with a few funky stops and sidelines in between.


Nice path! A lot of COBOL types never find out what they're missing. Mine has been similar:

8080 Assembler→Z80 Assembler→IBM 1130 Assembler→PDP-11 Assembler→VAX-11 Assembler→ThankGodThat'sOver

and

BASIC→Fortran→APL→RPG II (what's this doing in here?)→Pascal→C→Visual Basic→C++→Java

I had to learn LISP for my CompSci master's degree, but I have no idea to this day how any of those programs actually ever ran (nor why this language is so fiercely defended by its adherents).

Winston Gutkowski wrote:So, pretty boring by comparison.

Ya think? Try practicing Landlord / Tenant law and then get back to me on that.
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stevens Miller wrote:I'm everyone's worst nightmare come true: an American lawyer who writes computer programs.


So the rest of us get to make up half-baked legal theories and suffix them with "IANAL", but you can't do that.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
Stevens Miller wrote:I'm everyone's worst nightmare come true: an American lawyer who writes computer programs.


So the rest of us get to make up half-baked legal theories and suffix them with "IANAL", but you can't do that.


It's a cross I have to bear . Back when I still posted on Usenet (anyone remember Usenet?) I sometimes tagged my own half-baked legal theories with "IAAL" (obvious meaning), or even "Y,IRAAL." I found, however, that identifying one's self as an attorney in that context had a tendency to drag evey thread instantly off-topic, into extended diatribes about how stupid the American legal system is. Every thread, no foolin'. I note that things have moderated quite a bit in the last ten years.

This same point was made to me by a friend who works for a sub-contractor of NASA. In reply, I asked him, "When other people would say, 'Hey, this isn't rocket science,' you're kind of stuck, since, well, what you do is rocket science. So what do you say?" Remarkably, he had an answer all ready to give me. He said, "We use a Russian saying: It doesn't take a god to make a clay pot." That's become a common phrase in our household.

(Interestingly, I worked with a Russian some years ago, and asked him if he'd ever heard that saying. He thought about it and said "no." Then I asked him to say it to himself in Russian, which he did. His face lit up with a smile and he said, "Oh, yeah! I do know that saying!" Lesson in that, somewhere.)
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noble Graves,
Your post was moved to a new topic.
New question, new topic
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!