+ 2
I want to make triangle using even number
hello, how can i make triangle using even number like this? 2 4 12 6 14 20 8 16 22 26 10 18 24 28 30
5 Antworten
+ 8
there is also setw and setfill from iomanip
http://www.cplusplus.com/reference/iomanip/setw/
+ 1
If you assume your numbers are 3 digits max, you can use printf("%4d", x); to always use 4 spaces to print the number. If you wish to do a better centering job, use the following:
if (x < 10)
cout<<" "<<x<<" "; // 2 spaces, x, 1 space
else if (x < 100)
cout<<" "<<x; // 2 spaces, x
else
cout<<" "<<x; // 1 space, x
+ 1
rudolph, can you make the limit for the number? i want the even number less than 25 (2, 4, 6...., 24)
0
thanks rudolph, you are my hero
0
rudolph, can you give me the simple program again? the link is broken