View Code of Problem 3697

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int n;
	int s,k;
	int i,j;
	scanf("%d",&n);
	while(n--){
		scanf("%d %d",&k,&s);
		if(s>k){
		for(i=k;i<=s;i++){
			printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ",i,i,2*i,4*i);
			for(j=1;j<=i;j++){
				if(j==i)
				printf("splash.\n");
				else
				printf("splash ");
			}
		}
		
	}
else{
	for(i=s;i<=k;i++){
			printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ",i,i,2*i,4*i);
			for(j=1;j<=i;j++){
				if(j==i)
				printf("splash.\n");
				else
				printf("splash ");
			}
		}
		
	}
}
	return 0;
}

Double click to view unformatted code.


Back to problem 3697