Computer Science, asked by satnamsamra26, 8 months ago


Write a program to input a floating point number and round it off
For Example:
INPUT: Enter a floating point number: 12.367
OUTPUT: Rounded off to two places of decimal:12.37
INPUT: Enter a floating point number: 14.563
OUTPUT: Rounded off to two places of decimal: 14.56

Answers

Answered by CopyThat
8

Answer:

java :-

Explanation:

import java.util.*;

class Brainly

{

static void main()

{

Scanner sc=new Scanner(System.in);

float n;

int r;

System.out.println( “ Enter a floating point number:”);

n=sc.nextFloat();

r=(int)(n+0.5f);

System.out.println(“Answer=”+r);

}

}

Similar questions