I was configuring Standard ACL on router 1841 on Cisco Packet Tracer with the help of command access-list 1 permit 172.16.40.3 0.0.0.0 and access-list 1 deny 172.16.40.4 0.0.0.0 and then I applied this ACL to interface f0/0 which should have allowed the host 172.16.40.3 and blocked the host 172.16.40.4 instead it blocked the entire network 172.16.40.0 network not a single host can ping to the 172.16.10.1 router even the neighbour routers are not able to ping to 172.16.10.1 router. What should I do to solve this problem?
You need to use wildcards. What you did permits 172.16.40.3 to talk to 0.0.0.0 (invalid address) and the implied deny any any blocks anything else.
permit 172.16.40.3/32 0.0.0.0/0 deny 172.16.40.4/32 0.0.0.0/0 permit any any
permit 172.16.40.3 0.0.0.0 0.0.0.0 255.255.255.255 deny 172.16.40.4 0.0.0.0 0.0.0.0 255.255.255.255 permit any any