hey. when I use (ans!='d') the printf("sum\n") prints the line twice and then the getchar() function is beeing used.
on the other hand when I use (ans=='d') then the second ans= getchar() function doesn't work. the program just ends.Code:#include <stdio.h> main() { char ans; ans= getchar(); while(ans!='d') { printf("sum\n"); ans= getchar(); } }
what am I not doing correct?
dh