just take input a and b in one statement like this scanf("%d %d ",&a ,&b);On Sun, Oct 9, 2011 at 4:50 PM, Saravanan Selvamani < [email protected]> wrote: > Hi, > In the following programming when i gave character input rather > than integer , the following scanf statement is not working . so i introduce > the fflush(stdin) before the last scanf statement. > But i get the same error as i before . > #include<stdio.h> > int main() > { > int a,b; > scanf("%d",&a); > --------> > fflush(stdin); > scanf("%d",&b); > printf("%d",b); //prints some > garbage value. > return 0; > } > so then what is the use of the fflush(stdin) and how to correct the above > error? Thanks in advance. > Regards > P.S.Saravanan. > -- > why so serious????????? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
