Waterfall.java - import java.util.Scanner public class...

This preview shows page 1 out of 1 page.

import java.util.Scanner; public class Waterfall { /** * * @param args dawa */ public static void main (String[] args) { Scanner scnr = new Scanner(System.in); int i; int a = scnr.nextInt(); int b = 0; int c = 0; if (a % 2 ==1) { for (i = a; i > 0; i--) { if (i % 2 ==1) { System.out.print("\\"); ++b; } else { System.out.print("/"); ++c; } } System.out.println();

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture