class Pattern{
void printPattern(int number){
//The trival case
if (number == 1){
System.out.print(number);
return;
}
printPattern(number-1);
System.out.print(number);
printPattern(number-1);
}
public static void main(String args[]){
int number = Integer.parseInt(args[0]);
Pattern pattern = new Pattern();
pattern.printPattern(number);
}
}
Sorry no correct solutions this week!
No comments:
Post a Comment
Solution for this question?