friendly advice ...
Greetings ankur,
and welcome to the forum ...
here’s a suggestion that might help you more than a book ... write the specification for a VERY simple machine ... basically: tell us step-by-step how the machine should function ... keep it SIMPLE to begin with ... start with three or four steps ... we can go on from there ... then write a program that you THINK should satisfy the requirements that you’ve written ... post your specifications and your program on the forum ... tell us (if possible) what is confusing you ... we’ll be glad to try to help you over the rough spots ...