Monday, June 14, 2021

java program that get two number from user and calculate the sum (Java) (166)

package com.company;
import java.util.Scanner;
public class Program3 {
public static void main(String[] args) {
System.out.println("user input");
Scanner obj=new Scanner(System.in);
System.out.println("please enter first number:");
int a=obj.nextInt();
System.out.println("please enter the second number:");
int b=obj.nextInt();
int sum=a+b;
System.out.print("sum of two numbers are:");
System.out.println(sum);
}
}

No comments:

Post a Comment