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

Respuesta :

Answer:

Follows are the given statement to this question:

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

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("\n");//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.