Computer Science, asked by sayeedunnisawafiah, 6 months ago

program to accept and
print the values of one int and one
float variable. Also , print their sum
and difference. Write two outputs:

Answers

Answered by dattarajshinde44
0

Answer:

import java.util.*;

public class Question {

 public static void main(String[] agrs) {

   Scanner sc = new Scanner(System.in);

   System.out.println("Enter An Integer");

   int a = sc.nextInt();

   System.out.println("Enter An Float Value");

   value b = sc.nextInt();

   double c = a+b;

   double d = a-b;

   System.out.println("Sum = "+c);

   System.out.println("Difference = "+d);

}

}

Answered by anindyaadhikari13
1

Question:-

WAP to accept and print the values of one int and one float variable. Also , print their sum and difference.

Program:-

import java.util.*;

class Number

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter an int value: ");

int a=sc.nextInt();

System.out.println("Enter a float value: ");

float f=sc.nextFloat();

double d=a+f;

System.out.println("Sum: "+s);

d=a-f;

System.out.println("Difference is: "+d);

}

}

Similar questions