Computer Science, asked by Niharika1415, 1 year ago

plz answer the above question correctly...

Attachments:

Niharika1415: plz write the program given in the question
Niharika1415: correct answer will be marked as brainliest

Answers

Answered by san2018
1
// Returns count of minimum squares that sum to nint getMinSquares(unsigned int n){    // base cases    if (n <= 3)        return n;     // getMinSquares rest of the table using recursive    // formula    int res = n; // Maximum squares required is n (1*1 + 1*1 + ..)     // Go through all smaller numbers    // to recursively find minimum    for (int x = 1; x <= n; x++)    {        int temp = x*x;        if (temp > n)            break;        else            res =  min(res, 1+getMinSquares(n - temp));    }    return res;}

Niharika1415: thnx a lot dear
Niharika1415: bt cn u do a favour for me
Niharika1415: cn u plz write this program somewhere in notebook or smthng nd den send me d pic ...and dat to write the program ussing scanner class plzz...fen it will be more helpful for me and do the program in main method plz
Niharika1415: plzzzzzzz help me
Niharika1415: thank you :)
Similar questions