C++ Program to convert float to integer without type casting
In this program, You will learn how to convert float to integer without type casting in C++.
float x = 90.6f;
float to int :91
Example: How to convert float to integer without type casting in C++.
#include<iostream>
#include<math.h>
using namespace std;
int main() {
float x = 90.6f;
int y = round(x);
cout << "After convert float to int :" << y;
return 0;
}
Output:
After convert float to int :91