0% found this document useful (0 votes)
12 views1 page

Java Program for Summing Two Numbers

This Java program prompts the user to input two double values, a and b. It calculates the sum of these values, casts it to an integer, and prints the result. The program utilizes the Scanner class for user input and includes basic arithmetic operations.

Uploaded by

tachoriel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Java Program for Summing Two Numbers

This Java program prompts the user to input two double values, a and b. It calculates the sum of these values, casts it to an integer, and prints the result. The program utilizes the Scanner class for user input and includes basic arithmetic operations.

Uploaded by

tachoriel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import [Link].

*;

import [Link];

class Program {

private static Scanner input = new Scanner([Link]);

public static void main(String[] args) {

double a;

double b;

int sum;

[Link]("input value for a");

a = [Link]();

[Link]("input value for b");

b = [Link]();

sum = (int) (a + b);

[Link]("the sum is" + sum);

You might also like