answersLogoWhite

0

Can a float be displayed as a fraction in C?

Updated: 12/11/2022
User Avatar

Skullblast1

Lvl 1
13y ago

Best Answer

As a decimal fraction, yes.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a float be displayed as a fraction in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C programming percentages?

float percent = ((float)CurrentItems / (float)MaxItems);


How do you declare an array of 8 floats?

In C float a[8]; In Java float a[] = new float[8];


How is 10.444444 displayed as a fraction?

10.444444 is a fraction. It is a fraction in decimal form rather than in the form of a ratio. However, that does not stop it being a fraction. Its rational equivalent is 10444444/1000000 which can be simplified, if required.


What is each pie slice displayed in a pie chart an example of?

A fraction of 360 degrees


Is -5.501 rational or irrational?

Rational, since it can be displayed as a fraction. In this case, -5,501/100.


What is the source code in C to convert Celsius to Fahrenheit?

#include<io.sys> // Temperature conversion functions: float celcius_to_fahrenheit (double c) { return c * 9.0 / 5.0 + 32.0; } float celcius_to_kelvin (double c) { return c + 273.150; } float fahrenheit_to_celsius (double f) { return (f - 32.0) * 5.0 / 9.0; } float fahrenheit_to_kelvin (double f) { return celsius_to_kelvin (fahrenheit_to_celsius (f)); float kelvin_to_celsius (double k) { return k - 273.150; } float kelvin_to_fahrenheit (double k) { return celsius_to_fahrenheit ( kelvin_to_celsius (k)); int main (void) { double c, f; scanf ("Enter a temperature in Celsius: %f", c); printf ("%f Celsius is equal to %f Fahrenheit\n", c, celcius_to_fahrenheit (c)); return 0; }


What is five and three sevenths as an improper fraction?

If you have a mixed fraction a b/c, the improper fraction is (a*c + b)/c. I'll let you figure out this particular problem on your own. :)


What is 2.14 displayed as an improper fraction?

2.14= 2 14/100 = 2 7/50


How do you Write the mixed number as an improper fraction?

The mixed number ab/c is equivalent to the improper fraction (a*c+b)/c


Is their any scalar datatype in c language?

Float


How you can draw an ellipse in C language?

The C language does not provide any support for graphics as standard. C is designed to be as generic as possible, but graphics are a system-specific feature. To use graphics in C you need a third-party graphics library that supports your operating system and hardware, however generic libraries such as OpenGL are available. Nevertheless, it is not possible to draw curves, you can only approximate a curve using a series of short lines. The shorter the lines and the higher the resolution, the smoother the curve will appear. Assuming you have access to an OpenGL library, you can draw an ellipse as follows: void DrawEllipse(float cx, float cy, float rx, float ry, int num_segments) { const float pi = atan (1) * 4; float theta = 2 * pi / float (num_segments); float c = cosf (theta); float s = sinf (theta); float x = 1; float y = 0; float t; glBegin (GL_LINE_LOOP); for (int i = 0; i < num_segments; ++i) { glVertex2 f (x * rx + cx, y * ry + cy); t = x; x = c * x - s * y; y = s * t + c * y; } glEnd(); }


What is C in its lowest term as a fraction?

It is C/1.