How to Write Simple x + y Program in Java Programming Language
The following source code is a simple x + y program in the Java language.
class SimpleAdd{
public static void main(String args[]){
int x, y, result;
Scanner in = new Scanner(System.in);
System.out.println("Enter x : "); x = in.nextInt();
System.out.println("Enter y : "); y = in.nextInt();
result = x + y;
System.out.println("x + y = "+ result);
}
}
you can see the output here:
ShadowOfBdg© - All rights reserved.
No comments:
Post a Comment