Write a Python program that takes an integer as input , prints result if m is a sum of a square and cube | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a Python program that takes an integer as input , prints result if m is a sum of a square and cube

example for the output example 1: Enter a number: 12 2 **2 +  2 **3 =  12 example 2: Enter a number: 17 3 **2 +  2 **3 =  17 4 **2 +  1 **3 =  17

3rd Apr 2018, 2:16 PM
Gladson Dsouza
Gladson Dsouza - avatar
1 Answer
+ 13
1)run a loop from 1 to n ... a 2)run a loop inside 1) from 1 to n ...b 3)check condition a**2+b**3==n 4)if condition evaluated to true ... then print true ,a,b; & after that break; //hope it helps best without a code[which U have to make by yourself]
3rd Apr 2018, 2:52 PM
Gaurav Agrawal
Gaurav Agrawal - avatar