Do you know , you can make patterns using c programming ?

in hive-175254 •  2 years ago 

It was a busy day for me today but still i am here posting about my coding before i go to bed and take rest. The code we build today is very common and people who have learnt coding must be knowing about it very well.

I coded a star pattern and the homework i got today was to reverse this pattern so i will be doing that tomorrow but let me share the code we have for today.

Screenshot 2022-12-23 232652.png

#include <stdio.h>

int main()
{
int i, j;

for (i = 1; i <= 5; i++)
{
for (j = 1; j <= i; j++)
{
printf("*");
}
printf("\n");
}

return 0;
}

This is how the output will look like once you run teh program.

Screenshot 2022-12-23 232731.png

The outer loop (the one with the variable i) iterates over the rows of the pattern, and the inner loop (the one with the variable j) iterates over the columns. The inner loop prints a star for each iteration, and the outer loop starts a new line after each iteration. The number of rows and columns can be modified by changing the loop limits.

My my task for tomorrow is to reverse this pattern.

image.png

Source

I already have a solution in my mind but we will see if it works or not only after i code and run it.

I will also try to do more different things using this star to create some different pattern and i will see if i am able to be successful in that or not.

If you also want to learn coding then find your teacher according to your language. For me i am comfortable with hindi language and follow hindi teachers.

You can refer to my teacher below in case you are also comfortable with hindi.

Source

I will soon call myself a trader and a small programmer together.

Happy trading and keep learning what you love.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!