Assignment operator

We can assign a value to a variable by assignment operator (=). Let us consider the following code.

float a;
Here 45.25 has been assigned to a. In mathematics or equation concept ‘=’ is called equal sign but in programming it is called assignment operator.

problem: Write a C program to do the followings

1. declare a variable

2. assign a value to this variable

3. print this assigned value




Here output is 25.360001 but we assigned 25.36. Why? compiler always show six digits after decimal point and converted the fraction to a nearest value. Here 25.36 is converted to 25.360001.

Next Previous