2nd tutorial for right angle triangle patterns



Hope you all have tried to solve that patterns on your own. Are you facing any problem? Do not worry solution for all patterns will be explained to you in following tutorials.






Now here is the solution for program no. a1


In 1st tutorial ‘*’ pattern was explained in which two FOR loops are used. Here also same FOR loops are used, just to print alphabets instead of ‘*’ we need to change printf statement.


In printf statement we have written
Printf(“%c”,’A’ +j-1)

Here we want to print character so we need to use %c.

‘A’+j-1= here ‘A’ is used as default value and as we want to print ‘B’ as next character we use j to increment the loop of j i.e. inner for loop.

If you don’t want to use ‘A’+j-1, you can also use 65 +j-1, 64 + j, ‘@’ +j.



{ 0 comments ... read them below or add one }

Post a Comment