URI Online Judge | 1113
Ascending and Descending
Adapted by Neilor Tonin, URI Brazil
Timelimit: 1
Read an undetermined number of pairs of integer values. Write a message for each pair indicating if this two numbers are in ascending or descending order.
Input
The input file contains several test cases. Each test case contains two integer numbers X and Y. The input will finished when X = Y.
Output
For each test case print “Crescente”, if the values X and Y are in ascending order, otherwise print “Decrescente”.
Input Sample | Output Sample |
5 4 7 2 3 8 2 2 | Decrescente Decrescente Crescente |
URI Online Judge Solution 1113 || Ascending and Descending in JAVA
import
java.io.IOException;
import
java.util.Scanner;
public
class
Main {
public
static
void
main(String[] args)
throws
IOException {
int
X, Y;
Scanner input =
new
Scanner(System.in);
do
{
X = input.nextInt();
Y = input.nextInt();
if
(X > Y) {
System.out.print(
"Decrescente\n"
);
}
else
if
(X < Y) {
System.out.print(
"Crescente\n"
);
}
}
while
(X != Y);
}
}
URI Online Judge Solution 1113 || Ascending and Descending in C
#include<stdio.h>
int main(){
int X, Y;
do {
scanf("%d%d", &X, &Y);
if (X > Y) {
printf("Decrescente\n");
} else if (X < Y) {
printf("Crescente\n");
}
} while (X != Y);
}
URI Main question link
See Code in Dropbox
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks