printing powers in java

Thread Solved

Join Date: Apr 2009
Posts: 11
Reputation: smsamrc is an unknown quantity at this point 
Solved Threads: 0
smsamrc smsamrc is offline Offline
Newbie Poster

printing powers in java

 
0
  #1
Apr 15th, 2009
if i want to print 2 to the power 3 normally what we do is 2^3. is there any other way that i can print it in the console in the way that we normally write it on a paper.
does anyone know it pls tell me.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,580
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 199
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: printing powers in java

 
0
  #2
Apr 15th, 2009
Yes, read it in as a String and print it out. ?
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 1,668
Reputation: javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all 
Solved Threads: 225
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Virtuoso

Re: printing powers in java

 
0
  #3
Apr 15th, 2009
Originally Posted by BestJewSinceJC View Post
Yes, read it in as a String and print it out. ?
Actually what smsamrc is asking is to print at the console something like this:

To have 2 as base and 3 to be smaller and to the upper right corner of 2.
Check out my New Bike at my Public Profile at the "About Me" tab
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 55
Reputation: LevelSix is an unknown quantity at this point 
Solved Threads: 3
LevelSix's Avatar
LevelSix LevelSix is offline Offline
Junior Poster in Training

Re: printing powers in java

 
0
  #4
Apr 15th, 2009
So, a superscript?
http://java.sun.com/j2se/1.4.2/docs/...Attribute.html May be of use.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,580
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 199
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: printing powers in java

 
0
  #5
Apr 15th, 2009
Originally Posted by javaAddict View Post
Actually what smsamrc is asking is to print at the console something like this:

To have 2 as base and 3 to be smaller and to the upper right corner of 2.
Oops. I understand now.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 972
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 145
JamesCherrill JamesCherrill is offline Offline
Posting Shark

Re: printing powers in java

 
0
  #6
Apr 15th, 2009
Originally Posted by LevelSix View Post
So, a superscript?
http://java.sun.com/j2se/1.4.2/docs/...Attribute.html May be of use.
Do they work in the console? I suspect not. You could use the unicode symbols for ² or ³ (00B2 and 00B3), but that's all, I think.
In JLabels and the like you can use HTML formatting, of course.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 11
Reputation: smsamrc is an unknown quantity at this point 
Solved Threads: 0
smsamrc smsamrc is offline Offline
Newbie Poster

Re: printing powers in java

 
0
  #7
Apr 19th, 2009
thank you for ur hints.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC