I used the fflush() in Linux GCC but it did not work. Are there any alternatives for that function? Here is my code:
#include void main() {
#include int main() { char ans='y'; int a; while(ans=='y'||ans=='Y') { printf("Type a number:-"); scanf("%d",&a); printf("square of number = %d\nwant to enter number again(y/n)?\nANS=",a*a); scanf("%s",&ans);//use %s in place of %c } return 0; }