0

I'm trying to take integers from the user ,store them in array then do some math with them but the array is take 5 elements instead of 4

I can't see what I did wrong so can someone point to me where I did go wrong

#include <stdio.h>

int main (void){
int NumMsg[4];
int i =0;

printf("enter the msg one muber at the time and press enter: ");
for (i=0;i<4;i++){

    scanf("%d\n",&NumMsg[i]);                        
}
printf("the number before dycrption is :\n");
for (i=0;i<4;i++){
    printf("%d",NumMsg[i]);
}


return 0;
}

0 Answers0