This a simple code to print 6 numbers and then ask if the user want to continue, but in some point the value of my flag to continue changes. Any idea? And does the while at the end of the do-while block only accept one condition?
Here is the code:
void x(){
int i = 1, cont = 0;
char flag;
do{
if(cont == 6 && (flag != 'n' || flag != 'N')){
printf("(S/N)");
scanf("%c", &flag);
printf("\n :%c \n", flag);
if(flag == 's' || flag == 'S'){
cont = 0;
printf("\n");
}
}else{
printf("%d, ", i);
i++;
cont++;
}
}while(flag != 'n' || flag != 'N');
}