Computer Science, asked by dia8354, 1 month ago

sus
2. Write a java program to subtract a float number from an integer number and get
result in integer by using local variable.

Answers

Answered by kamalrajatjoshi94
9

Answer:

Program:-

import java.util.*;

public class Main

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int n;

float f;

double diff;

System.out.println("Enter a number:");

n=in.nextInt();

System.out.println("Enter a decimal number:");

f=in.nextFloat();

diff=n-f;

System.out.println("The difference between the numbers:"+(int)diff);

}

}

Attachments:
Similar questions