Source code of recursion program in java
Saturday, March 21, 2009
import java.io.*; class Recursion { public static void main(String args[])throws IOException { BufferedReader BR=new BufferedReader(new InputStreamReader(System.in)); String c,d; int n,i; long a,b; System.out.printf("Enter n:\n"); c=BR.readLine(); n=Integer.parseInt(c); System.out.printf("\nEnter the number :\n "); d=BR.readLine(); a=Long.parseLong(d); for(i=1;i<=n;i++) { b=a%10; a=a/10; System.out.printf("%d",b); } System.out.printf("\n"); } }
0 comments:
Post a Comment