Another Headache! You are stuck in Android App where you can to check if number is triangular or check if number is square but you’ve not good luck yet.

Let’s start the Android Studio, create a new empty activity, open up the XML of the activity and paste the following code.


Now Open the java file for that activity and paste the following code.

Replace isSquareTriangular class name with your class name, also edit the package for the class.

An output like this will be created, where you can easily put a number which the program will check if number is triangular, check if number is square or both.

[[Also check If you’re stuck at Activity must be exported or contain a Intent-Filter]]

In the below example, you can see that the Toast message shows that the number (1) is Both. If you will check other numbers it will tell you the other two parts of App if number is triangular or square.

if number is triangular


Final Words on Check If Number is Triangular or Square

Sometimes the university or college assignment and mini projects will ruin your happiness but not anymore, Just follow the above steps, if there anything wrong or you have a question just ask us in the comment section.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!