114k views
4 votes
Given an integer variable i and a floating-point variable f, write a statement that writes both of their values to standard output in the following format: i=value-of-i f=value-of-f Thus, if i has the value 25 and f has the value 12.34, the output would be: i=25 f=12.34 But if i has the value 187 and f has the value 24.06, the output would be: i=187 f=24.06

User Hrk
by
6.7k points

1 Answer

7 votes

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variable

int i;

float f;

cout<<"enter an integer:";

// read integer

cin>>i;

cout<<"enter a floating point:";

// read floating point

cin>>f;

// print both

cout<<"i="<<i<<" f="<<f<<endl;

return 0;

}

Step-by-step explanation:

Read an integer and assign it to "i" then read a floating point and assign it to "f".After then print "i= value-of-i f=value-of-f" .

Output:

enter an integer:25

enter a floating point:12.34

i=25 f=12.34

User WagnerMatosUK
by
7.2k points