Menu
Topics Index
...
`

Weekend Hack - 1 - 19 Jan 2013 - Rs. 150 has these questions


Datatype for Facebook likes

Assuming that there are 6 million facebook users and each having 125 likes, which data type would you use to store the total number of likes on facebook?
A. int
B. long
C. float
D. double



Print Possible Ages Of Children

Write a program to print all the possible ages given the number of children and product of their ages. The possibilities should be sorted as shown below. Use System.out.print or System.out.println for printing.
Input (Integer, Integer) Printed Output
Number = 1, Product = 6 6
Number = 2, Product = 3 1 3
Number = 3, Product = 24 1 1 24
1 2 12
1 3 8
1 4 6
2 2 6
2 3 4
Number = 3, Product = 12 1 1 12
1 2 6
1 3 4
2 2 3
Number = 2, Product = 72 1 72
2 36
3 24
4 18
6 12
8 9
class PrintPossibleAgesOfChildren

{    public static void main(String s[])
    {
        printPossibleAges(3, 24);

    }


public static void printPossibleAges(int numberOfChildren, int productOfTheirAges) {
//Write a code here to print all the possible ages of children. Use System.out.println or System.out.print for printing.
}

//If required, write any additional methods here
}



© meritcampus 2019

All Rights Reserved.

Open In App