求助,这段代码为什么执行到一半就直接退出了?
程序如下,但是执行到“printf("Do you wish to add more numbers(y/n)\n");”就不往下执行了,这是为什么呢?求指点。#include<stdio.h>
int main(void)
{
int a,b,c;
char ch;
while(1)
{
printf("Enter values of a and b\n");
scanf("%d%d",&a,&b);
c=a+b;
printf("a + b =%d\n",c);
printf("Do you wish to add more numbers(y/n)\n");
scanf("%c",&ch);
if(ch=='y'||ch=='Y')
continue;
else
break;
}
return 0;
}