Prerequisite – PL/SQL introduction
In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations.
Given a number n, the task is to find the sum of its first and last digit.
Input: 14598. Output: Sum of the first and last digit is 9. Input: 987456. Output: Sum of the first and last digit is 15.
Approach is to use the substr() function and store the first and last digit and then print their sum.
Below is the required implementation:
Sum of the first and last digit is 9
- PLSQL : || Operator
- PLSQL | LN Function
- PLSQL | EXP Function
- PLSQL | LOG Function
- PLSQL | ABS Function
- PLSQL | LEAST Function
- PLSQL | COS Function
- Difference between SQL and PLSQL
- PLSQL | MOD Function
- PLSQL | SIN Function
- PLSQL | CHR Function
- PLSQL | TAN Function
- PLSQL | LENGTH4 Function
- PLSQL | LENGTHB Function
- PLSQL | LENGTH Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.