This is a simple pattern which teach how to
adjust numbers such that if two digit number such as 10 can b exactly below the
one digit number. This can be done by adjusting decimal value.
In this pattern simply we have to arrange
numbers like this:
Program for this pattern is very simple and
easy.

Printf statement is changed, here we have
to print integers so we use “%d”. Here to adjust decimal value we have added
02.d this will adjust the decimal
numbers after 9 i.e. two digit numbers.
If we do not include 02.d the output will
be not in perfect pattern such as
567
8910
But if we add
“%02.d” so we get perfect patterns one below other such as
5 6 7
8 9 10
You can notice
the difference which one looks perfect.
{ 0 comments ... read them below or add one }
Post a Comment