# how to make input number to be like percentage

Page 1 of 1

## 3 Replies - 7917 Views - Last Post: 30 March 2010 - 08:06 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=165116&amp;s=0e925a159b522d2b91988071c59c1545&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 ksaihat

Reputation: -1
• Posts: 27
• Joined: 11-March 10

# how to make input number to be like percentage

Posted 30 March 2010 - 06:25 AM

Hi
How to make input number as a percentage (eg. 3.0)
can i use printf with it?if yes how to do it?

```double number;
System.ott.print(enter number as a percentage:);

```

thanks
Is This A Good Question/Topic? 0

## Replies To: how to make input number to be like percentage

### #2 Luckless

• </luck>

Reputation: 293
• Posts: 1,146
• Joined: 31-August 09

## Re: how to make input number to be like percentage

Posted 30 March 2010 - 06:43 AM

I'm confused by your question. 3.0 is a decimal, not a percentage, but in order to get a percentage you would have to pick apart the double number and write a method to display it as a percentage. for example, if the user inputs .5, you would have to right a method to do something like multiply it by 100 then display a % sign next to it( just for looks, not math)

also, this will never work

Quote

```double number;
System.ott.print(enter number as a percentage:);

```

it needs to be like this

```double number;
System.out.print("Enter number as a percentage: ");

```

I'm assuming you already have created a Scanner objected named read. You must be consistent with your data types or else nothing will work Best of luck and I'll be happy to help if you have another question

### #3 ksaihat

Reputation: -1
• Posts: 27
• Joined: 11-March 10

## Re: how to make input number to be like percentage

Posted 30 March 2010 - 07:00 AM

Hi
put you did not understand what i need

i want to know how to make the percentage number eg.80% to be entered as 8.0

Thanks

### #4 Dogstopper

Reputation: 2965
• Posts: 11,222
• Joined: 15-July 08

## Re: how to make input number to be like percentage

Posted 30 March 2010 - 08:06 PM

That's called a decimal, not a percentage, as luckless was nice enough to help you with.