C++, how I can make a code giving me triangular numbers I'm still a beginner | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++, how I can make a code giving me triangular numbers I'm still a beginner

25th May 2019, 11:43 AM
WiseP💯
WiseP💯 - avatar
8 Answers
+ 2
Take the numbers on the left side of the triangle they'll give you numbers 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666.. as that link says, I see no difference
25th May 2019, 12:27 PM
WiseP💯
WiseP💯 - avatar
+ 1
What do you mean by triangular numbers?
25th May 2019, 11:49 AM
Airree
Airree - avatar
+ 1
Producing this sequence 1,4,9,16,25,36
25th May 2019, 11:52 AM
WiseP💯
WiseP💯 - avatar
+ 1
just make a function that returns the square of the number, and have an incrementing value, and print the result. And they are never called triangle numbers. They are called square numbers
25th May 2019, 11:54 AM
Airree
Airree - avatar
+ 1
They are called triangular numbers when you draw the triangle,,,,, such that on the right end you have an increasing number of square numbers, and on the right you have the triangular numbers,, I was simplifying
25th May 2019, 11:56 AM
WiseP💯
WiseP💯 - avatar
+ 1
1. You said the sequence is 1, 4, 9, 16, 25, 36 2. I already gave you a guide for the code
25th May 2019, 12:38 PM
Airree
Airree - avatar
0
Can I get a guide for the codes
25th May 2019, 12:28 PM
WiseP💯
WiseP💯 - avatar