Write a program to check if a number is triangular or not. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program to check if a number is triangular or not.

18th Aug 2017, 6:57 PM
Mohit
Mohit - avatar
8 Answers
+ 2
You sum number starting of with 1 and if this sum is >= your input number, you compare it with your input number. If it's equals, return true. https://code.sololearn.com/cUXMSuP9F6mQ/?ref=app
18th Aug 2017, 7:09 PM
Jonas Schröter
Jonas Schröter - avatar
+ 1
Thanks for the solution.
18th Aug 2017, 7:20 PM
Mohit
Mohit - avatar
+ 1
Glad I could help.
18th Aug 2017, 7:21 PM
Jonas Schröter
Jonas Schröter - avatar
0
which country are you from?
18th Aug 2017, 7:21 PM
Mohit
Mohit - avatar
0
Germany
18th Aug 2017, 9:04 PM
Jonas Schröter
Jonas Schröter - avatar
0
Oh! that's great
19th Aug 2017, 5:13 AM
Mohit
Mohit - avatar
0
And you?
19th Aug 2017, 5:48 AM
Jonas Schröter
Jonas Schröter - avatar
0
India.
19th Aug 2017, 6:06 AM
Mohit
Mohit - avatar