Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdbool.h>
- #include <stdio.h>
- int main() {
- int previus, current;
- scanf("%d", &previus);
- scanf("%d", ¤t);
- // true if increasing
- // false if decreasing
- bool isIncreasing = current >= previus;
- if (isIncreasing) {
- // Increasing
- while (isIncreasing) {
- previus = current;
- scanf("%d", ¤t);
- isIncreasing = current >= previus;
- }
- } else {
- // Decreasing
- while (!isIncreasing) {
- previus = current;
- scanf("%d", ¤t);
- isIncreasing = current >= previus;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement