Computer Science, asked by sahiljoseph2006, 4 months ago

write a program in jave to calculate and print the sum of two number​

Answers

Answered by wkhanyari
0

Explanation:

public class AddTwoNumbers {

public static void main(String[] args) {

int num1 = 5, num2 = 15, sum;

sum = num1 + num2;

System.out.println("Sum of these numbers: "+sum);

}

}

Output:

Sum of these numbers: 20

Answered by ankita711
0

Explanation:

import java.util.*;

public class sum

{

public static void main ( string args [ ] )

{

Scanner sc = new scanner ( system.in );

int a , b , c , sum;

System.out.print("Enter a number :" +a);

a=sc.nextInt();

System.out.print("Enter the second number:"+b);

b = sc.nextInt();

{

c= a+b;

}

System.out.println("The sum of two numbers is = " +c);

}

}

HOPE THIS HELPS YOU.

Similar questions
Science, 1 month ago