Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

ava program to add two numbers taking input from user

import java.util.Scanner;public class Main{public static void main(String[] args){int a, b, sum;Scanner sc = new Scanner(System.in);System.out.println("Enter First Number: ");a = sc.nextInt();System.out.println("Enter Second Number: ");b = sc.nextInt();sc.close();sum = a + b;System.out.println("Sum of these numbers: "+sum);}}
Source by inlarn.com #
 
PREVIOUS NEXT
Tagged: #ava #program #add #numbers #input #user
ADD COMMENT
Topic
Name
7+5 =