long Data Type

 

On the other side if we have a very large whole number that can not be stored in int then we use the data type long provided by C. So when we are going to deal with very big whole numbers in our program, we use long data type. We use it in program as:

                       long x = 300500200;

 

Real Numbers

The C language provides two data types to deal with real numbers (numbers with decimal points e.g. 1.35, 735.251). The real numbers are also known as floating point numbers. 

*      float

*      double

 

float Data Type

To store real numbers, float data type is used. The float data type uses four bytes to store a real number. Here is program that uses float data types.

 

#include <iostream.h>

main()

{

            float x;

            float y;

            float z; 

            x = 12.35;

            y = 25.57;

            z = x + y;

            cout << “ x = “;

            cout << x;

            cout << “ y = “;

            cout << y;

            cout << “ z = x + y = “;

            cout << z;

}

 

 

Here is the output of the above program. 

x = 12.35 y = 25.57 z = x + y = 37.92

 

 

 

Previous

 

 

TOC

 

 

Next