Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove the first number from an integer?

Tags:

c

I need to intake a number like: 200939915

After doing this, which I know how, I need to remove the first number so it becomes: 00939915

What is the best way to do this?

like image 899
Mark Provan Avatar asked Nov 30 '10 23:11

Mark Provan


People also ask

How do you remove digits from an integer?

To delete nth digit from starting:Get the number and the nth digit to be deleted. Count the number of digits. Loop number of digits time by counting it with a variable i. If the i is equal to (number of digits – n), then skip, else add the ith digit as [ new_number = (new_number * 10) + ith_digit ].

How do you remove digits from an integer in Python?

Note that Python integers are immutable, so the only way to remove a digit from an integer is to create a new integer that doesn't contain the digit. An alternative approach is to use string slicing. To remove the last digit from an integer: Use the str() class to convert the integer to a string.

How do you remove the first two digits of a number in Python?

Use string slicing to remove first characters from a string Use string slicing syntax string[n:] with n as the amount of characters to remove the first n characters from a string.


1 Answers

char *c = "200939915";
char *d = c + 1;
like image 79
Matt K Avatar answered Oct 18 '22 22:10

Matt K