Pyramid using C with a new logic.

There are many ways of solving a programming problem , and every one has his own logic to solve a problem. Here I also implemented a new logic using C language’s printf() function.
printf() function is more than just writing output to the screen i.e. it returns the number of characters it writes on the output screen.

One functionality of printf() is as follows.

printf(“Hello”+1); = ello
printf(“ABCDE”+2); = CDE
It skips the first n characters if we are using printf(“message”+n);

Another functionality of printf method is :

If we write =>  int num = printf(“Hello”); . Then num will have value 5 (Hello has 5 letters).

Similarly if we write,

int num = printf(“2017”);. Then num will have value 4 (2017 has 4 characters).

Pyramid Using C
Pyramid Using C

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.