View Code of Problem 3697

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int n;
	int s,k;
	int i,j;
	int m,e,l;
	int sp;
	scanf("%d",&n);
	while(n--){
		scanf("%d %d",&s,&k);
		if(k>s){
		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 ");
			}
		}
		
	}
}
else{
	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 ");
			}
		}
		
	}
}
	return 0;
}

/*
Main.c: In function 'main':
Main.c:26:1: error: 'else' without a previous 'if'
 else{
 ^
Main.c:9:6: warning: unused variable 'sp' [-Wunused-variable]
  int sp;
      ^
Main.c:8:10: warning: unused variable 'l' [-Wunused-variable]
  int m,e,l;
          ^
Main.c:8:8: warning: unused variable 'e' [-Wunused-variable]
  int m,e,l;
        ^
Main.c:8:6: warning: unused variable 'm' [-Wunused-variable]
  int m,e,l;
      ^
Main.c: At top level:
Main.c:39:2: error: expected identifier or '(' before 'return'
  return 0;
  ^
Main.c:40:1: error: expected identifier or '(' before '}' token
 }
 ^
*/

Double click to view unformatted code.


Back to problem 3697