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 and range and the task is to display all the numbers whose sum of digits is equal to the given number.
Input: x = 23
Output: 599 689 698 779 788 797 869 878 887 896 959 968 977 986 995
(Note: range->1 to 999)
Output: 39 48 57 66 75 84 93
(Note: range->1 to 100)
Approach is to take a number, find all the possible numbers in the given range and sum all the digits of number and if sum of digits is equal to the number, then print that number.
Below it’s implementation:
799 889 898 979 988 997
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Find smallest number with given number of digits and sum of digits under given constraints
- Numbers of Length N having digits A and B and whose sum of digits contain only digits A and B
- Find the Largest number with given number of digits and sum of digits
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Minimum digits to be removed to make either all digits or alternating digits same
- Sum of the digits of square of the given number which has only 1's as its digits
- Number formed by deleting digits such that sum of the digits becomes even and the number odd
- Maximize the given number by replacing a segment of digits with the alternate digits given
- Number of digits in the nth number made of given four digits
- Find a number x such that sum of x and its digits is equal to given n.
- PLSQL | LOG Function
- PLSQL | INSTR Function
- PLSQL | INSTRB Function
- PLSQL | LENGTH2 Function
- Difference between SQL and PLSQL
- PLSQL | SOUNDEX Function
- PLSQL | ASCII Function
- PLSQL | CONCAT Function
- PLSQL | COMPOSE 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 email@example.com. 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.