Please give code in C The exercise instructions here are LON

Please give code in C

The exercise instructions here are LONG -- please read them all carefully. If you see an internal scrollbar to the right of these instructions, be sure to scroll down to read everything. Given that an integer variable i and a floating-point variable f have already been declared and given values : Write a statement in C that displays the values of i and f to standard output in the following format: i = value -of - i f = value - of - f Two Examples: if the values of i and f were 25 and 12.34 respectively, the output would be: i = 25 f = 12.34 if the values of i and f\'s value were 703 and 3.14159, (respectively) the output would be: i = 703 f = 3.14159 Remember: you are GIVEN i and f-- that means they are already declared and they already have values ! Don\'t change their values by assigning or initializing them! Just print them out the way we have shown above. Just write one statement to produce the output. Remember: you don\'t know what the actual values of i and f are-- they are unlikely to be the values used in the examples above! Remember: in your output you must be displaying both the name of the variable (like i) and its value.

Solution

Answer: printf(\"i=%d f=%f\", i, f);

printf is used to write a values to standard output.

%d is a control string to display integer value and %f is a control string to display floating point value.

Please give code in C The exercise instructions here are LONG -- please read them all carefully. If you see an internal scrollbar to the right of these instruct

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site