# How to set Value per token?

how the Smart contract decide how much token need to be send on every 1 Ethereum ? didn't found any which define such function, anyone ?

You need to specify the price of your token. Then when you are selling tokens in exchange for ether you divide the amount of ether by the price of each token. However, take into consideration that solidity does not have a representation of float numbers so 10/3 is 3, not 3.333333. To have a decimal representation you define how many decimal points you want and multiply your values by 10**decimal.

Here an example:

``````contract MyToken{
uint public price;
uint public decimals;
uint mult_dec;
mapping (address => uint) public balanceOf;

function MyToken() public {
price = 100000000000000000; //price in wei 1 Token = 0.1ETH
decimals = 18;
mult_dec = 10**decimals;
}

Remember that the balances are then multiplied by 10**decimals. If you use mist and you "watch" the contract defining `decimals`, mist will show the correct number of tokens.