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
- Find a number x such that sum of x and its digits is equal to given n.
- Find a Number X whose sum with its digits is equal to N
- Smallest number k such that the product of digits of k is equal to n
- Greatest number less than equal to B that can be formed from the digits of A
- Check if product of digits of a number at even and odd places is equal
- Largest number smaller than or equal to n and digits in non-decreasing order
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Check whether product of digits at even places is divisible by sum of digits at odd place of a number
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Maximize the given number by replacing a segment of digits with the alternate digits given
- Find the Largest number with given number of digits and sum of digits
- Find the first N integers such that the sum of their digits is equal to 10
- Find the average of k digits from the beginning and l digits from the end of the given number
- Count different numbers that can be generated such that there digits sum is equal to 'n'
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.