P
papoupapa
Hi,
The code below doesn't read the condition that says to stop when the
entry is 0. A while loop might be more convenient....
#include <stdio.h>
#define CMAX 5
int main(void)
{
int Numbers[CMAX] ;
int nbr_in ;
int i, j ;
nbr_in = 1 ;
j = 0 ;
for (i = 0 ; (nbr_in != 0) || (i < CMAX) ; i++, j++)
{
printf("\nValue %d : ", i+1) ;
scanf("%d", &nbr_in) ;
Numbers = nbr_in ;
}
printf("\n\nOUTPUT : \n") ;
for (i = 0 ; ((Numbers != 0) || (i < CMAX)) ; i++)
printf("\n%d. : %d", i+1, Numbers) ;
printf("\n\n") ;
return 0 ;
}
Thanks in advance,
The code below doesn't read the condition that says to stop when the
entry is 0. A while loop might be more convenient....
#include <stdio.h>
#define CMAX 5
int main(void)
{
int Numbers[CMAX] ;
int nbr_in ;
int i, j ;
nbr_in = 1 ;
j = 0 ;
for (i = 0 ; (nbr_in != 0) || (i < CMAX) ; i++, j++)
{
printf("\nValue %d : ", i+1) ;
scanf("%d", &nbr_in) ;
Numbers = nbr_in ;
}
printf("\n\nOUTPUT : \n") ;
for (i = 0 ; ((Numbers != 0) || (i < CMAX)) ; i++)
printf("\n%d. : %d", i+1, Numbers) ;
printf("\n\n") ;
return 0 ;
}
Thanks in advance,