View Code of Problem 3697

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int a[n][2];
	int i,j;
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i][0],&a[i][1]);
		if(a[i][0]>a[i][1]){
			int temp;
			temp=a[i][0];
			a[i][0]=a[i][1];
			a[i][1]=temp;
		}
	}
	for(i=0;i<n;i++){
		for(j=a[i][0];j<=a[i][1];j++){
			if(j==1){
				printf("1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a splash.\n");
			}
			else{
				printf("%d frogs have %d mouth, %d eyes and %d legs, jump into the water with",j,j,2*j,4*j);
				int k;
				for(k=0;k<j;k++){
					printf(" splash");
				}
				printf(".\n");
			}
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3697