#include <iostream>
using namespace std;
void printValue(int x) {
cout << "Value=" << x;
}
void printValue(float x) {
cout << "Value=" << x;
}
int main() {
float val;
cin >> val;
if (val == (int)val) {
printValue((int)val);
} else {
printValue(val);
}
return 0;
}
Solution Details
👉 In simple words:
You only write the two functions. The program will figure out which one to use.
Significance for Embedded Developers
Input
42
Expected Output
Value=42