C Program to Check Whether a Number is Prime or Composite

A prime number is the number which can be exactly divided by only 1 and the number itself. For example, 11 can only be exactly divided by 1 and the number itself, so 11 is a prime number. But 14 can be divided by 1, 2, 7 and 14 so it is not a prime number but a composite number.

C program to check whether a number is prime or composite is shown below.

Constructors in C++ Programming

Constructors are the member functions that are executed automatically when an object is created. That means no explicit call is necessary to call a constructor. The name constructor is given because it constructs the value of the data member of class. Constructors are mainly used or initializing data.

Encapsulation in C# Programming

Encapsulation is the process of collecting functions and data in one unit called class. Encapsulation is also known as process of hiding data in object oriented programming languages. Encapsulation allows specify access level of a class or its members. This protects data from being corrupted and codes will be less complex, maintainable and flexible.