c - How to delete the first digit of a given number? -
how can delete first digit of given number using user defined function (suppose function deltop
) ?
for ex.,
x=deltop(1748);
i want value of x
748
.
would tell me how write function ?
you can divide number ten, until number < 10.
1748/10 = 174 174/10 = 17 17/10 = 1
now know iteration count 3 , have 1 multiplier , can use following formula:
yournumber - 1 (this 1 "multiplier") * 10^3 (the 3 "iteration count") = 748
Comments
Post a Comment