View Code of Problem 3697

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    while (n--) {
        int a, b;
        scanf("%d%d", &a, &b);
        if (a <= b) {
            for (int i = a; i <= b; i++) {
                printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ", i, i, i * 2, i * 4);
                for (int j = 0; j < i; j++) {
                    if (j != 0) {
                        putchar(' ');
                    }
                    printf("splash");
                }
                puts(".");
            }
        }
        else {
            for (int i = b; i <= a; i++) {
                printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ", i, i, i * 2, i * 4);
                for (int j = 0; j < i; j++) {
                    if (j != 0) {
                        putchar(' ');
                    }
                    printf("splash");
                }
                puts(".");
            }
        }
    }
}

Double click to view unformatted code.


Back to problem 3697