1)
x=inputbox("enter a number with decimal")
whole=mid(x,1,instr(1,x,".")-1)
deci=mid(x,instr(1,x,".")+1,len(x))
if mid(deci,1,1) >=5 then whole=whole+1
msgbox whole
2)
x=inputbox("enter a decimal no with 1 digit after the decimal point")
whole=x*10
deci=whole mod 10
whole=whole-deci
whole=whole/10
if deci>=5 then
whole=whole+1
end if
msgbox whole
x=inputbox("enter a number with decimal")
whole=mid(x,1,instr(1,x,".")-1)
deci=mid(x,instr(1,x,".")+1,len(x))
if mid(deci,1,1) >=5 then whole=whole+1
msgbox whole
2)
x=inputbox("enter a decimal no with 1 digit after the decimal point")
whole=x*10
deci=whole mod 10
whole=whole-deci
whole=whole/10
if deci>=5 then
whole=whole+1
end if
msgbox whole
No comments:
Post a Comment