If I enter 66, I want to exit the loop and end the program, but I keep getting debug errors;; why is this happening?
#include <stdio.h>
int main(void)
{
char ntmp;
int check = 0;
do {
scanf("%d", &ntmp);
if (ntmp == 65) {
printf("%c", ntmp);
}
if (ntmp == 66) {
check = -1;
}
} } while (check != -1);
printf("\n");
return 0;
}
#include <stdio.h>
int main(void)
{
int ntmp;
int check = 0;
while (1) {
scanf("%d", &ntmp);
if (ntmp == 65) {
printf("%c", ntmp);
}
else if (ntmp == 66) {
break;
}
}
printf("\n");
return 0;
}
Do you want this?
© 2024 OneMinuteCode. All rights reserved.