Java Program print series using recursion (n to 1)

import java.util.*;
class printnumbers
{
static int sum=0;
public static void main(String args[])
{
int n=0;
System.out.println("enter the number");
Scanner sc= new Scanner(System.in);
n=sc.nextInt();
System.out.println("the series is");
int k=Pnum(n);
}
static int Pnum(int n)
{
 if(n<1)
 {
 return 0;
 }
 else
 {
 System.out.print(" "+n);	 
 return (Pnum(n-1));
 }
}
}

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial