Java Tutorial
Reads three integers and computes the sum of them.
import java.util.*; class Sum { public static void main(String args[]) { System.out.println("Enter the numbers: "); Scanner Sc=new Scanner(System.in); int a=Sc.nextInt(); int b=Sc.nextInt(); int c=Sc.nextInt(); int s=a+b+c; System.out.println("Sum is :"+s); } }Output:
D:\Java_Programs>javac Sum.java D:\Java_Programs>java Sum Enter the numbers: 2 3 4 Sum is: 9
Java Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page