Java exercises, a daily Java applet -1...__ Small program

Source: Internet
Author: User
Java exercises, how much you can do. http://bbs.csdn.net/topics/110067294
This is seen from CSDN. One every day.
"Program 11"
Question: There are 1, 2, 3, 4 digits, which can be composed of a number of different and no duplicate number of three digits. is how much.
1. Procedure analysis: Can fill in the hundred, 10 digits, single-digit digits are 1, 2, 3, 4. Make up all the permutations and then remove the arrangement that does not satisfy the condition.
This topic is very simple, do not like the program analysis, the direct traversal of the array can be.

= = = = = = = Main.java = Package Main;
public class Main {public static void main (string[] args) {int array[] = {1, 2, 3, 4}; int I, j, K;
for (i = 0; i < 4; i++) {for (j = 0; J < 4; J +) {if (j = i) {continue;}
for (k = 0; k < 4; k++) {if (k = i) | | (k = = j)) {continue;}
SYSTEM.OUT.PRINTLN (array[i] * + array[j] * + array[k]); } } } } }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.