//https://csprograms4u.blogspot.com/
//Chapter 1
//Program 8
//Shorthand Assignment Operators
import
java.util.Scanner;
public
class SHAO
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a,b,c,d;
System.out.println("Enter First
Number");
a=sc.nextInt();
System.out.println("Enter Second
Number");
b=sc.nextInt();
System.out.println("Enter Third
Number");
c=sc.nextInt();
System.out.println("Enter Fourth
Number");
d=sc.nextInt();
System.out.println("a="+a);
System.out.println("b="+b);
System.out.println("c="+c);
System.out.println("d="+d);
a+=b;//a = a +
b
System.out.println("After adding a
and b the ans is="+a);
System.out.println("Now
a="+a);
a-=c;//a = a -
c
System.out.println("After sub c
from a the ans is="+a);
System.out.println("Now
a="+a);
a*=d;// a = a *
d
System.out.println("After mul a
and d the ans is="+a);
System.out.println("Now
a="+a);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.