1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka94
3 years ago
7

Create union floatingPoint with members float f, double d and long double x. Write a program that inputs values of type float, d

ouble and long double and stores the values in union variables of type union floatingPoint. Each union variable should be printed as a float, a double and a long double. Do the values always print correcly? Note The long double result will vary depending on the system (Windows, Linux, MAC) you use. So do not be concern if you are not getting the correct answer. Input must be same for all cases for comparison Enter data for type float:234.567 Breakdown of the element in the union float 234.567001 double 0.00000O long double 0.G0OO00 Breaklo n 1n heX float e000000O double 436a9127 long double 22fde0 Enter data for type double :234.567 Breakdown of the element in the union float -788598326743269380.00OGOO double 234.567000 long double 0.G00000 Breakolon 1n heX float 0 double dd2f1aa0 long double 22fde0 Enter data for type long double:
Computers and Technology
1 answer:
Kitty [74]3 years ago
5 0

Answer:

Here the code is given as follows,

#include <stdio.h>

#include <stdlib.h>

union floatingPoint {

float floatNum;

double doubleNum;

long double longDoubleNum;

};

int main() {

union floatingPoint f;

printf("Enter data for type float: ");

scanf("%f", &f.floatNum);

printf("\nfloat %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type double: ");

scanf("%lf", &f.doubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type long double: ");

scanf("%Lf", &f.longDoubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

return 0;

}

You might be interested in
You develop an app, and you don’t want anyone to resell it or modify it. This is an example of: A
Maru [420]

Answer:

C, proprietary software

Explanation:

Proprietary software, also known as non-free software, is computer software for which the software's publisher or another person reserves some rights from licensees to use, modify, share modifications, or share the software. It sometimes includes patent rights.

7 0
3 years ago
Difference between ram and rom​
BigorU [14]

Answer:

<h2> RAM</h2>
  • <em>It</em><em> </em><em> </em><em>stands</em><em> </em><em>for</em><em> </em><em>Random</em><em> </em><em>Access</em><em> </em><em>memory</em><em>.</em>
  • <em>It</em><em> </em><em>is</em><em> </em><em>used</em><em> </em><em>for</em><em> </em><em>both</em><em> </em><em>purpose</em><em>(</em><em> </em><em>read</em><em> </em><em>and</em><em> </em><em>write</em><em>)</em><em>.</em>
  • <em>It</em><em> </em><em>is</em><em> </em><em>volati</em><em>le</em><em> </em><em>memory</em><em>.</em>
<h2><em>R</em><em>O</em><em>M</em></h2>
  • <em>It</em><em> </em><em>stands</em><em> </em><em>for</em><em> </em><em>Read</em><em> </em><em>only</em><em> </em><em>memory</em><em>.</em>
  • <em>It</em><em> </em><em>can</em><em> </em><em>be</em><em> </em><em>used</em><em> </em><em>only</em><em> </em><em>to</em><em> </em><em>perform </em><em>the</em><em> </em><em>read</em><em> </em><em>oper</em><em>ation</em><em>.</em>
  • <em>It</em><em> </em><em>is</em><em> </em><em>non-volatile</em><em>.</em>

<em>Hope</em><em> </em><em>this</em><em> </em><em>helps</em><em>.</em><em>.</em><em>.</em>

<em>Good</em><em> </em><em>luck</em><em> on</em><em> your</em><em> assignment</em><em>.</em><em>.</em><em>.</em>

8 0
3 years ago
Read 2 more answers
You recently created several new user accounts in the Sales OU and configured them with the appropriate group membership, logon
irga5000 [103]

Answer:

Disable the account until the employee is ready to use it.

Explanation:

6 0
3 years ago
Which is a method used to determine database requirement?
Ivahew [28]

Answer:

I think it would be A, good luck!

8 0
3 years ago
A student has a ten-year-old desktop computer that she only uses for word processing, but she would like to start using it to pl
wariber [46]

Answer:

She should buy a new one or buy a Gaming PC to upgrade the setup.

Explanation:

6 0
3 years ago
Other questions:
  • Jail and prison officials may generally limit inmate rights when the limitations serve
    13·2 answers
  • 13. What is the suggested rpm on a hard drive for a laptop?
    12·1 answer
  • Describe two ways in which an organizer can assist in taking notes
    8·2 answers
  • Given an int as the input, print all the factors of that number, one in each line. For example, if the input is 15 The output wi
    14·2 answers
  • Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the en
    6·1 answer
  • Dynamic programming does not work if the subproblems: ___________
    5·1 answer
  • Here is the header for a function named computeValue:
    11·1 answer
  • When would the Jerusalem virus attack?<br> 1. Friday the 13th<br> 2. Wednesday the 13th
    13·2 answers
  • ISO 400 is twice as sensitive and ISO 100 true or false
    7·1 answer
  • You are reviewing a friend’s HTML project. You notice that the only metadata is the title. Furthermore, you ask your friend abou
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!