I want to print if else statement. the else if which is greater is executing but a[i]==0 is not executing. How to deal with that?
#include <stdio.h>
#include <stdlib.h>
int main(){
int nl, i, j, count=0;
printf("Enter the number of values: ");
scanf("%d",&nl);
int a[nl];
for(i=0; i<nl; i++){
printf("Enter the number: ");
scanf("%d", &a[i]);
if (a[i]<nl){
printf("Less than\n");
}
else if(a[i]>nl){
printf("Greater than\n");
}
else if(a[i]==0){
printf("Equal\n");
}
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire