当前位置:网站首页>Xiao Wang's interview training task

Xiao Wang's interview training task

2022-06-27 21:38:00 continueLR

Catalog

XZK-JAVA- Regional missions -010102- Xiao Wang's interview ( Basic grammar ) 

1. Define an integer variable and assign any five digit positive integer as the initial value , Judge whether it is a five digit palindrome number ?

2. Define an integer variable and assign any five digit positive integer as the initial value , Output the sum of the numbers

3. Defining integer variables a、b, Write will a、b A program for exchanging the values of two variables ( The third variable cannot be used )

4. Please write a paragraph that complies with the coding specification Hello World Code  


 

XZK-JAVA- Regional missions -010102- Xiao Wang's interview ( Basic grammar ) 

1. Define an integer variable and assign any five digit positive integer as the initial value , Judge whether it is a five digit palindrome number ?

public class Demo {
	public static void main(String[] args){
	int num = 12321;
	int ge = num%10;
	int shi = num%100/10;
	int qian = num%10000/1000;
	int wan = num%100000/10000;
	System.out.println(ge);
	System.out.println(shi);
	System.out.println(qian);
	System.out.println(wan);
	if(ge==wan&&shi==qian){
		System.out.println(" This number is the palindrome number ");
	}else {
		System.out.println(" This number is not a palindrome number ");
	}
  }
}

Five palindromes , Existing = ten thousand , Ten = thousand ; 


2. Define an integer variable and assign any five digit positive integer as the initial value , Output the sum of the numbers

public class Eemo {
	public static void main(String[]args){
		
		int num = 12345;
		int ge = num%10;
		int shi = num%100/10;
		int bai = num%1000/100;
		int qian = num%10000/1000;
		int wan = num%100000/10000;
		int sum = ge+shi+bai+qian+wan;
		System.out.println(sum);

	}
}

3. Defining integer variables a、b, Write will a、b A program for exchanging the values of two variables ( The third variable cannot be used )

public static void main(String[] args) {
		
		int a=10;
		int b=12;
		a=a+b;
		b=a-b;
		a=a-b;
		System.out.println(a+" and "+b);
		
	}
}

4. Please write a paragraph that complies with the coding specification Hello World Code  

public class HolleWord {

	public static void main(String[] args) {
		System.out.println("HolleWord");

	}

}

 

 

原网站

版权声明
本文为[continueLR]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206271920421680.html