Software can be protected by copyright law and patent law.
Under copyright law, software or the computer program is usually regarded as a "literary work". The unique characteristic of computer programs that differentiate them from other literary works is their dynamic essence, which usually includes algorithms or mathematical formulae's or logical condition etc, which manipulate symbols producing certain virtual or physical effects,etc. Copyright law provides protection to the software or the computer program´s expression and not the functional aspects of the software. Hence, computer programs differ from other copyright-able subject matter, in the sense that the text is not the most important aspect; rather the importance lies in the functions established by the program code.
Patent: Patent is becoming the method of protection for computer program's, software or E-commerce website. The Patent Act offers patent protection to product or process (if they satisfy various requirements of patentability) as long as they do not fall under non-patentable subject matter. Any method/process relating to non-technological field shall not be considered patentable. Further, software protected under the patents act should satisfy the patentability criteria.In order to meet patent-ability criteria, the software or the computer program executed on a computer processor must be novel or confers a new solution to a technical problem, and non- obvious to one of "ordinary skill" in the field of invention.
Regarding exclusion of patenting softwares:The Patent office have been granting patents to computer implemented inventions or software related inventions based on the technical solution provided to the technical problem, generally known as the technical character. So one of the keys for successfully having a patent granted for software innovation lies in the ability to present the software innovation in such a way that the it includes technical character.
If a computer program or software protected under copyright law protects an original work in the tangible fixed form in which it has been set down, whereas a computer program or software protected under the patent law protects the creation of inventive concepts as well as their practice.
For further details please check the link below