Print N 1 Recursively Input Format First Line Contains T Number Test Cases Next T Lines Co Q37130995

Print N to 1 Recursively.

Input Format

First Line contains T – Number of testcases.
Next T lines contain one integer N per line.

Output Format

For each test case print N to 1 in a separate line.

Sample Input

3
5
2
10

Sample Output

5 4 3 2 1
2 1
10 9 8 7 6 5 4 3 2 1

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {

/* Enter your code here. Read input from STDIN. Print output toSTDOUT */
return 0;
}

Must be in java


Solution


import java.util.Scanner;

public class Numbers{
  
public static void main(String []args){

System.out.print(“OUTPUT”);
System.out.println(“”);
  
Scanner nmbr = new Scanner(System.in);
  
// temp is holding, how many numbers we to use for recursion
int temp = nmbr.nextInt();

for(int i=1 ;

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.