As in earlier tutorials we have seen all right angle
triangle patterns for alphabets. Now we can make same and more other patterns
using that same logic of looping for numbers.
To perform program for the pattern looks like:
Here we have to arrange integer numbers in same way as we
have arranged ‘*’ in our first tutorial. So logic of loop remains same we just
need to change printf statement.
As you can see in program that printf statement is changed
as here we have to print numbers in a pattern. Here j is initialised from 1 and
printing it and then by incrementing it in loop we can print as many numbers we
want.
Here as we have to print numbers i.e. integer value so we use
‘%d’.
This pattern seems easy as you have already practised
looping used in program.
{ 0 comments ... read them below or add one }
Post a Comment