+ 1
Please run this code and tell me why got this result!!!
#include<stdio.h> int main() { int a = 0; while(a < 20) {//run until a < 20 printf("Do you want to continue?[Y/N]?"); char b; scanf("%c",&b); if(b == 'Y') { printf("Yes\n"); } else { a += 20; //if b != 'Y' break the loop } a++; } return 0; }
3 odpowiedzi
+ 2
What Output u expecting through this program..?
+ 1
I expect to enter 'Y' until the end of loop but it stop when I enter the first 'Y'.
+ 1
I have a try with your code here see https://code.sololearn.com/cB6u4XfV5A2Q/?ref=app