+ 25
[🏆 Challenge 🏆]: Pronic Numbers 🎮⚠💡🏆🔢
A pronic number is a number which is the product of 2 consecutive integers. Write a code to check if the inputted number is pronic or not an also print those 2 consecutive integers if the number is pronic Note - 0 is also a pronic number Eg- Input -> 12 Output -> 12 is pronic as 12=3*4 You can see my code too- https://code.sololearn.com/cVKRMRBDtKxD/?ref=app
65 ответов
+ 25
my code is modified ... try it now ☺👍
//upgraded to show solution using loops and quadratic both ☺
⬜🌹🌹🌹🌹🌹⬜
🌹⬜⬜⬜⬜⬜⬜
🌹⬜⬜⬜⬜⬜⬜
🌹⬜⬜⬜🌹🌹🌹
🌹⬜⬜⬜⬜⬜🌹
🌹⬜⬜⬜⬜⬜🌹
⬜🌹🌹🌹🌹🌹⬜
https://code.sololearn.com/cZYWW7NrE6Y3/?ref=app
+ 23
https://code.sololearn.com/cdm8Jcu28T3m/?ref=app
+ 16
https://code.sololearn.com/cB6IfkFI0Uho/?ref=app
+ 14
Here's my try in Ruby:
https://code.sololearn.com/cA534T0Tc33h/#rb
+ 14
Here's my C# implementation! ✌
I'm inclined for Maths related challenge and this is really interesting. Special thanks to Oma Falk for the insight! Enjoy~ ❤
https://code.sololearn.com/c9139Lvylj22/?ref=app
+ 12
Without loop https://code.sololearn.com/cd9AlEO8Uo71/?ref=app
+ 12
+ 11
heja I found a very simple solution 😉😉
https://code.sololearn.com/c8Zv37VrY5NV/?ref=app
+ 10
https://code.sololearn.com/c6LzV20tL4KU/?ref=app
+ 9
@Swapnil: Mine updated to include zero ;)
+ 8
I had told that 0 was also a pronic number. But many codes don't output that. Otherwise all nice codes.
+ 8
@Oma Falk Basically it's a nice trick of completing the square for the expression n(n + 1). 😉
+ 8
a further simple pronic tester (-:
https://code.sololearn.com/cMTTl39AO1g7/?ref=app
+ 7
@VcC your code is fast but it is neither user friendly nor does it show which 2 integers make it pronic. Otherwise good code.
EDIT: Now no problems with the code.
+ 7
Here's mine in C++
https://code.sololearn.com/caZOgMaV2ycE/?ref=app
+ 7
https://code.sololearn.com/cRcur9eLc83l/?ref=app