• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
August 03, 2022 |3.5K Views
C++ Program to Delete Nth Digit of a Number
Description
Discussion

In this video, we will see C++ Program to Delete Nth Digit of a Number.

Here we see two methods to Delete Nth Digit of a Number:

1. Using for loop
2. Using Math operation

Method:

Step 1: Get the number and the nth digit to be deleted.
Step 2: Count the number of digits
Step 3: Loop number of digits time by counting it with a variable i.
Step 4: 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 ].

Example:

Input: num= 1237n = 1
Output= 137

C++ Program to Delete Nth Digit of a Number.
https://www.geeksforgeeks.org/program-to-delete-nth-digit-of-a-number/

Read More