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
Social Sciences,
1 month ago
Computer Science,
1 month ago
English,
2 months ago
Computer Science,
9 months ago
Social Sciences,
9 months ago