Загрузка...

Assingment operators in java

package operatorAssingment; import java.util.Scanner; public class AssingmentOperator { public static void main(String[] args) { Scanner er=new Scanner(System.in); // part-1:- // assigning values using (+=):- System.out.println("enter any number of yoour choice:"); int a=er.nextInt(); a+=25; System.out.println("the value of the entered number after adding 25 to it is:"+a); // part-2:- // assigning values using (*=):+ System.out.println("enter any number of your choice:"); int b=er.nextInt(); b*=25; System.out.println("the value of the entered number after multiplying 25 to it is: "+b); // similarly other assignment operators(-=,/=,%=) can also be used // part-4:- // special case l-shift,r-shift operators:- System.out.println("enter the number whose l-shifted value(upto 2 places) you want to calculate:"); int p=er.nextInt(); p(use less than symbol twice )=2; System.out.println("the l-shifted value of the given number is:"+p); System.out.println("enter the number whose r-shifted value(upto 2 places) you want to calculate:"); int k=er.nextInt(); k(use greater than symbol twice)=2; System.out.println("the r-shifted value of the given number is:"+k); //the complete source code is in the description } }

Видео Assingment operators in java автора Байтовое Приключение
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки