Results 1 to 5 of 5
Thread: Actions
- 01-30-2011, 09:09 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Actions
a. Write an action that accepts an integer num returns the number of digits
b. Write an action that accepts an integer, and returns the difference between the leftmost digit and the rightmost digit
Use the steps in a.
c. Write a program which takes in 10 pairs of numbers, the program Atedpsat number difference between left digit number is the largest right
What is the problem?Java Code:public static int inc(int x){ int count=0; while(x!=0){ x=x/10; count++; } return (count); } public static int jjj(int y){ int first=0,last=0; last=y%10; for(int i=0;i<inc(y);i++){ first=y/10; } return(Math.abs( first-last)); } public static void main(String[] args) { Scanner in = new Scanner( System.in); int x; System.out.println("Enter number"); x=in.nextInt(); System.out.println(jjj(x)); } }
- 01-30-2011, 09:13 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
You tell us...do you get exceptions? Does it behave in a way which is unexpected (if so do tell)?What is the problem?
- 01-31-2011, 06:04 AM #3
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
I need help!
- 01-31-2011, 02:59 PM #4
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Did you read my previous post? We have no idea what the problem is because YOU need to tell us. If you want help, I suggest you help those will to lend a hand by reading my previous post and explaining what the problem is. Better yet, read this: How To Ask Questions The Smart Way
- 01-31-2011, 04:45 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
actions for buttons
By steel in forum AWT / SwingReplies: 1Last Post: 12-02-2010, 05:42 AM -
JSP standard actions
By subhashis_mohanty in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 11-27-2010, 07:35 AM -
How to Use Actions
By AJArmstron@aol.com in forum New To JavaReplies: 4Last Post: 04-18-2010, 09:03 PM -
Button Actions
By vasavi.singh in forum Advanced JavaReplies: 3Last Post: 04-03-2009, 09:50 PM -
Actions
By alley in forum AWT / SwingReplies: 2Last Post: 01-16-2008, 02:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks