#include <stdio.h>
int EstaOrdemCrescente(int vetor[], int tamanho) {
for (int i = 1; i < tamanho; i++) if (vetor[i - 1] > vetor[i]) return 0;
return 1;
}
int main() {
printf(EstaOrdemCrescente
((int[]){-1, 2, 3, 4, 5}, 5) ? "Esta em ordem crescente\n" : "Nao esta em ordem crescente\n"); printf(EstaOrdemCrescente
((int[]){-1, 2, 0, 4, 5}, 5) ? "Esta em ordem crescente\n" : "Nao esta em ordem crescente\n"); printf(EstaOrdemCrescente
((int[]){1}, 0) ? "Esta em ordem crescente\n" : "Nao esta em ordem crescente\n"); }
//https://pt.stackoverflow.com/q/334712/101
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgRXN0YU9yZGVtQ3Jlc2NlbnRlKGludCB2ZXRvcltdLCBpbnQgdGFtYW5obykgewogICAgZm9yIChpbnQgaSA9IDE7IGkgPCB0YW1hbmhvOyBpKyspIGlmICh2ZXRvcltpIC0gMV0gPiB2ZXRvcltpXSkgcmV0dXJuIDA7CiAgICByZXR1cm4gMTsgCiB9CiAKIGludCBtYWluKCkgewogICAgcHJpbnRmKEVzdGFPcmRlbUNyZXNjZW50ZSgoaW50W10pey0xLCAyLCAzLCA0LCA1fSwgNSkgPyAiRXN0YSBlbSBvcmRlbSBjcmVzY2VudGVcbiIgOiAiTmFvIGVzdGEgZW0gb3JkZW0gY3Jlc2NlbnRlXG4iKTsKICAgIHByaW50ZihFc3RhT3JkZW1DcmVzY2VudGUoKGludFtdKXstMSwgMiwgMCwgNCwgNX0sIDUpID8gIkVzdGEgZW0gb3JkZW0gY3Jlc2NlbnRlXG4iIDogIk5hbyBlc3RhIGVtIG9yZGVtIGNyZXNjZW50ZVxuIik7CiAgICBwcmludGYoRXN0YU9yZGVtQ3Jlc2NlbnRlKChpbnRbXSl7MX0sIDApID8gIkVzdGEgZW0gb3JkZW0gY3Jlc2NlbnRlXG4iIDogIk5hbyBlc3RhIGVtIG9yZGVtIGNyZXNjZW50ZVxuIik7Cn0KCi8vaHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzMzNDcxMi8xMDE=