Maximum and minimum common number, monkey peach eating problem, chicken problem, print a prime number of 1-

Source: Internet
Author: User
1 // maximum common approx. and minimum common multiples 2 then SC = new then (system. in); 3 if (SC. hasnextint () {4 int n = SC. nextint (); 5 Int M = SC. nextint (); 6 int A = 0; 7 int Gy = 0; 8 If (M> N) {9 A = N; 10} else {11 A = m; 12} 13 for (INT I = 1; I <= A; I ++) {14 if (N % I = 0 & M % I = 0) {15 Gy = I; 16} 17} 18 system. out. println ("+ Gy); 19 system. out. println (the minimum public multiples of N + "and" + M + "are:" + N * m/Gy); 20 21} else {22 system. out. println ("guasecile! "); 23}
// Monkey peach problem int peach = 1; for (INT I = 0; I <9; I ++) {peach = (peach + 1) * 2;} system. out. println (peach );
// For (INT I = 0; I <100; I ++) {for (Int J = 1; j <33; j ++) {for (int K = 0; k <20; k ++) {if (I % 3 = 0 & I/3 + J * 3 + K * 5 = 100 & I + J + k = 100) {system. out. println ("chicken:" + I + "hen" + J + "Rooster" + k );}}}}
// Print the prime number of 1--100 for (INT I = 2; I <100; I ++) {Boolean tab = true; For (Int J = 1; j <= I; j ++) {if (I % J = 0 & J! = 1 & I! = J) {tab = false ;}}if (Tab) {system. Out. println (I );}}

 

Maximum and minimum common number, monkey peach eating problem, chicken problem, print a prime number of 1-

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.