answersLogoWhite

0

You declare a floating point variable using the float or double keyword for a single- or double-precision floating point variable, respectively:

float a;

double b;

You reference a floating-point variable just like any other scalar variable by using the variable's name in a compatible expression, e.g.

a += 2;

b /= a;

Floating point literals use a period for the decimal point, no "thousands separator," and use the letter 'e' to denote a power of ten, e.g.

a = 0.123;

b = 123e-3;

Both a and b now have the same value, 123 times 10 to the power of -3 (which equals 0.123).

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

How many values can store a variable at a time?

The number of values a variable can store at a time depends on the data type of the variable. For example, a variable of type int (integer) in many programming languages can store a single integer value at a time. Similarly, a variable of type float (floating-point number) can store a single floating-point value. Other data types like arrays or lists can store multiple values at a time. The capacity of a variable to store values is determined by its data type and memory allocation.


Is 10e10 can be used in c?

Yes, as a floating point constant.


How do you write numbers in printf?

In C, you can use the printf function to write numbers by specifying a format specifier. For example, %d is used for integers, %f for floating-point numbers, and %x for hexadecimal representation. You can also include formatting options, such as width and precision, like %.2f to display a floating-point number with two decimal places. Here’s a simple example: printf("Integer: %d, Float: %.2f\n", 42, 3.14);.


What are the types of data type?

Character or small integerShort IntegerIntegerLong integerBooleanFloating point numbersDouble precision floating point numberLong double precision floating point numberWide characterTo get a better idea on C++ data types, see related links below.


How do you Write a value returning function using c programming that receives two floating point numbers and returns true if the first formal parameter is greater than the second.?

bool isBigger (float a, float b) { return a > b;}

Related Questions

How do you save a radian value in c plus plus?

You can write it into a file as a floating-point value.


How many values can store a variable at a time?

The number of values a variable can store at a time depends on the data type of the variable. For example, a variable of type int (integer) in many programming languages can store a single integer value at a time. Similarly, a variable of type float (floating-point number) can store a single floating-point value. Other data types like arrays or lists can store multiple values at a time. The capacity of a variable to store values is determined by its data type and memory allocation.


What is 10.1455785 in c language?

A floating point constant value.


Is 10e10 can be used in c?

Yes, as a floating point constant.


How would you write 12 of the variable c?

12c


What is the possible reason if the turbo C compiler displays an error like this Illegal use of floating point?

Floating-point library not linked in.


C program to receive floating point and convert it into binary?

scanf


Which manipulator is used to control the precision of floating point numbers?

In C and C++, the manipulator used to control the precision of floating point numbers is std::setprecision. This manipulator is part of the <iomanip> header and allows you to specify the number of digits to be displayed after the decimal point for floating-point output. For example, using std::cout << std::setprecision(3) will format floating-point numbers to three decimal places.


What is the c code for printing binary value of floating point values?

16


How would you write 136 divided by c?

To express 136 divided by ( c ), you would write it as ( \frac{136}{c} ). This notation indicates that 136 is being divided by the variable ( c ). Alternatively, you could also write it as ( 136 \div c ).


What is IEEE standard in c plus plus?

The format of floating-point numbers. On some platforms.


How do you assign the product of variables b and c to variable a?

To assign the product of variables b and c to variable a in most programming languages, you would use the assignment operator. For example, you would write a = b * c;. This statement multiplies the values of b and c, and then assigns the result to the variable a.