145k views
1 vote
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:
Example 1: if the values of i and f were 25 and 12.34 respectively, the output would be: i=25 f=12.34
Example 2: if the values of i and f's value were 703 and 3.14159, (respectively) the output would be: i=703 f=3.14159

User Reidisaki
by
8.1k points

1 Answer

5 votes

Answer:

Follows are the given statement to this question:

printf("i=%d f=%f", i, f);//print value

Step-by-step explanation:

The full code to the given question:

code:

#include <stdio.h>//defining header file

int main()// main method

{

int i;//declaring integer variable

float f;//declaring float variable

i=25; //assign integer value

f=12.34;//assign float value

printf("i=%d f=%f", i, f);//print value

i=703;//assign integer value

f=3.14159;//assign float value

printf("\\");//for line break

printf("i=%d f=%f", i, f);//print value

return 0;

}

Output:

i=25 f=12.340000

i=703 f=3.141590

In the above-given code, the two variable "i and f" is declared, that holds integer and floating-point value in its respective variable and use the print method, to print "i and f" variables value.

User Adnan Habib
by
8.0k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.