View Code of Problem 3697

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		while(n-->0) {
			int k=scanner.nextInt();
			int s=scanner.nextInt();
			
			for(int i=Math.min(k, s);i<=Math.max(k,s);i++) {
				if(i==1) {
					System.out.print(i+" frog has "+i+" mouth, "+i*2+" "
							+ "eyes and "+i*4+" legs, jump into the water with");
					for(int j=1;j<=i;j++) {
						System.out.print(" splash");
					}
					System.out.println(".");
				}
				else {
					System.out.print(i+" frogs have "+i+" mouths, "+i*2+" "
						+ "eyes and "+i*4+" legs, jump into the water with");
					for(int j=1;j<=i;j++) {
						System.out.print(" splash");
					}
					System.out.println(".");
				}
				
			}
		}
	}

}

Double click to view unformatted code.


Back to problem 3697