Sunday, June 2, 2013

Eight Math Opetaror

import java.util.Scanner;

//here we will make a pair of girl and boy

class EightMathOprator {
     public static void main (String args[]){
         Scanner bucky = new Scanner(System.in);
         int girl , boys, people , left;
         String who;
           
             System.out.println("How many Girls :-");
                        girl = bucky.nextInt();

             System.out.println("How many Boys :-");
                       boys = bucky.nextInt();
                     
         if(girl > boys)
         {
         people = girl / boys;
         left = girl - boys;
         who = "Girl";
         people = girl;

         }
         else
         {
             people = boys / girl;
             left = boys - girl;
             who = "Boys";
             people = boys;
         }



         if (left == 0 ){

         System.out.println("We can make pair :- " + people  );
                         }
         else
         {
             System.out.println("We can't make pair As "   + left + " " + who +  " is more in number ");
         }



     }

}

==================  Out put ====================================

How many Girls :-
56
How many Boys :-
45
We can't make pair As 11 Girl is more in number

No comments:

Post a Comment