Abdullah047

Question 3

Dec 21st, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. */
  2. import java.util.Scanner;
  3. public class AssignmentQuestion3 {
  4.  
  5. static int bunnyCounter=0;
  6. public static void main(String[] args){
  7. Scanner sc=new Scanner(System.in);
  8. int a=sc.nextInt();
  9. bunnyEars(a);
  10. System.out.print(bunnyCounter);
  11. }
  12. public static void bunnyEars(int x){
  13.  
  14.  
  15. if(x>0){
  16. bunnyCounter+=2;
  17. bunnyEars(x-1);
  18.  
  19. }
  20.  
  21. }
  22.  
  23.  
  24. }
Add Comment
Please, Sign In to add comment