001-006-014

Float to Int

Easy

Problem Description

Float to Int

In this problem, you will create a program that casts a float value to int using (int) cast, truncating the decimal part, and displays the result to standard output.

Learning Objective: Understand the basics of float to int

Overview

Convert a float value (e.g., 2.9f) to int using (int) cast and display the result. In Java, casting with (int) truncates the decimal part.

Output Format

Int: 2

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up