Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i find the digits of a number

Status
Not open for further replies.

iamprem

Programmer
Nov 15, 2001
4
US
hi folks
how do i find the digits of a number and what value that digit is ?????
to start of may be i just want to print the digits of a number
any help would be greatly appreciated thank you
Prem
 
Code:
int x = 73491;
String s = new String("" + x);
for(int n=0; n<s.length(); n++)
	System.out.println(&quot;Digit[&quot; + n + &quot;] = &quot; + s.charAt(n));

does that help?
-pete
 
thanks pete, that did help me
thank you very much
Prem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top