Thanks Alpha, if it is an infinite loop, then how does the program terminate. Actually I had to write a program which keeps on taking input until it encounters 2 successive instances of zeros. This is how I wrote it. Tell me if this is the correc way.