write a program in jave to calculate and print the sum of two number
Answers
Answered by
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
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
History,
1 month ago
English,
1 month ago
English,
4 months ago
Computer Science,
10 months ago
Social Sciences,
10 months ago