Chicken and rabbit cage problem

Source: Internet
Author: User

1. Chicken and rabbit cage, a total of 30 head, 88 feet. How many chickens and rabbits are there in the cage?

2. Chicken Rabbit with Cage, a total of 48, feet 132, how many chickens and rabbits?

3. A breeding group altogether raises the chicken, the rabbit 78, altogether has 200 feet, asks the rearing group raises the chicken and the rabbit each how many only?

4. The chicken rabbit with the cage does not know the number, 36 head cage in Dew. A total of 50 pairs of feet, how many chickens and rabbits each?

ImportJava.util.Scanner; Public classChickenandrabbit { Public Static voidMain (string[] args) {System.out.println ("Chicken and rabbit cage problem"); @SuppressWarnings ("Resource") Scanner SC=NewScanner (system.in); System.out.println ("Please enter the number of headers:"); intTou =Sc.nextint (); System.out.println ("Please enter the number of legs:"); intTUI =Sc.nextint ();  for(intj = 1;j<=tou;j++){             for(intt = 1;t<=tou;t++){                if(j + t = = Tou && 2*j + 4*t = =tui) {System.out.println ("The number of chickens is:" +j); System.out.println ("The number of rabbits is:" +t); }            }        }    }}

Chicken and rabbit cage problem

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.