003-006-006

Casting to int Type

Easy

Problem Description

Casting to int Type

Learning Objective: Understand how to explicitly cast from double to int type

Overview

Create a program that casts a double value to int type and outputs the truncated integer value.

Specifications

  • Initialize a double variable price with 1980.75
  • Cast to int type and assign to variable intPrice
  • Output the result

Output Format

Price: 1980

Ready to Try Running Code?

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

Don't have an account?