0
I’m a beginner in programming and I’m still making several mistakes, you could help me find out why the loop is not completing the loop?
#include <stdio.h>
int main(){
int N, X[N], controle = 0;
int i, menor = 0, posicao = 0;
setbuf(stdin, NULL);
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d", &controle);
X[i] = controle;
}
for (i = 0; i < N; i++){
if(X[i] <= menor){
menor = [i];
posicao = i;
}
}
printf("Menor valor: %d\n", menor);
printf("Posicao: %d\n", posicao);
return 0;
}
Ahhh, I understand perfectly, thank you very much!
– Ryann