public class P2 {
  public static void calculRec(int i,int n) {
    if (i==n) return;
    System.out.println(i);
    calculRec(i+1,n);
  }
  public static void calculRecTransforme(int i,int n) {
    while (i!=n) {
      System.out.println(i);
      i = i+1;
    }
  }
  public static void calcul(int n) {
    int i;
    for (i=0; i<n; i++) {
      System.out.println(i);
    }
  }
  public static void main(String []a) {
    calcul(4);
    calculRec(0,4);
    calculRecTransforme(0,4);
  }
}