Program to print all two-digit numbers in descending order Last Updated : 20 Feb, 2024 Comments Improve Suggest changes Like Article Like Report Write a program to print all the two-digit numbers in descending order, that is print all the two-digit numbers from largest to smallest. Output format: 99 98 97 96 95 94 93 ..... 13 12 11 10 Approach: We know that the largest two-digit number is 99 and the smallest two-digit number is 10. So, we can start from 99 and then keep on decreasing the number and print till we reach 10. Step-by-step algorithm: Declare a for loop which start from 99 and keep on decreasing the number by 1 till we reach 10.For each iteration, print the number.After all the iterations, we will have all the two-digit numbers printed in decreasing order.Below is the implementation of the above approach: C++ #include <iostream> using namespace std; int main() { for(int number = 99; number >= 10; number --) { cout << number << " "; } return 0; } Java public class Main { public static void main(String[] args) { // Iterate from 99 to 10 in reverse order for (int number = 99; number >= 10; number--) { // Print the current number followed by a space System.out.print(number + " "); } } } Python3 # Iterate from 99 down to 10 (inclusive) for number in range(99, 9, -1): # Print the current number followed by a space print(number, end=" ") # Add a newline after printing all numbers print() C# using System; class Program { static void Main() { // Loop from 99 to 10 in decreasing order for (int number = 99; number >= 10; number--) { Console.Write(number + " "); } // Ensure a newline after printing the numbers Console.WriteLine(); } } JavaScript for (let number = 99; number >= 10; number--) { console.log(number + " "); } //this code is contribited by Prachi Output99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33...Time Complexity: O(1)Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article Program to print all two-digit numbers in descending order M mrityuanjay8vae Follow Improve Article Tags : DSA Similar Reads C++ program to print all Even and Odd numbers from 1 to N Given a number N, the task is to print N even numbers and N odd numbers from 1. Examples: Input: N = 5 Output: Even: 2 4 6 8 10 Odd: 1 3 5 7 9 Input: N = 3 Output: Even: 2 4 6 Odd: 1 3 5 Approach: For Even numbers:Even numbers are numbers that are divisible by 2.To print even numbers from 1 to N, tr 4 min read Program to print ASCII Value of all digits of a given number Given an integer N, the task is to print the ASCII value of all digits of N. Examples: Input: N = 8Output: 8 (56)Explanation:ASCII value of 8 is 56 Input: N = 240Output:2 (50)4 (52)0 (48) Approach: Using the ASCII table shown below, the ASCII value of all the digits of N can be printed: DigitASCII V 5 min read Print all numbers up to N in words in lexicographical order Given an integer N, the task is to print all numbers from 1 to N (0 < N < 100000) in words in lexicographical order. Examples : Input: N = 11Output: eight, eleven, five, four, nine, one, seven, six, three, twoExplanation: The numbers from 1 to N is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. Their resp 8 min read Print number in ascending order which contains 1, 2 and 3 in their digits. Given an array of numbers, the task is to print those numbers in ascending order separated by commas that have 1, 2, and 3 in their digits. If no number containing digits 1, 2, and 3 is present then print -1. Examples: Input : numbers[] = {123, 1232, 456, 234, 32145}Output : 123, 1232, 32145 Input : 6 min read Print all numbers in given range having digits in strictly increasing order Given two positive integers L and R, the task is to print the numbers in the range [L, R] which have their digits in strictly increasing order. Examples: Input: L = 10, R = 15 Output: 12 13 14 15 Explanation: In the range [10, 15], only the numbers {12, 13, 14, 15} have their digits in strictly incr 5 min read Like