U. Float or int – Codeforces Problem Solution in C++

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/U

#include<iostream>
using namespace std;
int main() {
	double num; // 234.450  234.000
	cin>>num;
	int numInt = num; // 234
	double res = num - numInt;
	if(res != 0){
		cout<<"float "<<numInt<<" "<<res<<endl;
	} else {
		cout<<"int "<<numInt<<endl;
	}
}

Assiut University Training – Newcomers solution

Leave a Comment