Offer to come, dig friends take it! I am participating in the 2022 Spring Recruit series activities – click on the task to see the details of the activities.

Hello, I’m Ze 奀 : One item for progress (●’◡’●). ✉️ we don’t play the stage we choose, the play is not the script we choose 📩

preface

Hello, everyone. Today began to brush topic 18, do not know how you have done in front of the topic. Can you do it or not, because it should be easy. If you are a beginner, you may want to spend more time to practice, but not more debugging to find the corresponding knowledge points. Come on (@ ^ 0 ^)

Topic describes

Enter a number and print a right triangle.

Subject analysis

Don’t panic when you encounter problems with strong logical thinking. There is a way to solve these problems effectively. That’s the substitution method, and it’s something that you can usually do if you’re not very good at it or if you’re new to it.

Assuming that the number we entered is ⑤, the result is as follows.

*

**

***

****

*****

So when we encounter the above code we can analyze it. First of all, we need to know rows and rows, so there are five rows and at most five rows, why is it the most, so if you look at the first row you print a star, and so on and so on and you print one more star every time you have one more row. So that’s the key to this problem. If you know this then you should be able to solve the problem. For this kind of problem line can be made by loop nesting. We need to pay particular attention to the second loop statement, because that’s the key here. You can never print an effect of increasing the * of its columns, perhaps only the rows to its standard. This kind of problem must go to practice more, only constantly go to practice you can master this kind of problem to do the method.

The subject code

#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main(void) { int i = 0; int j = 0; int input = 0; Printf (" Please enter a number :"); scanf("%d", &input); for (i = 0; i < input; i++) { for (j = 0; j <= i; j++) { printf("*"); } printf("\n"); } return 0; }Copy the code

The results

Please enter the number: 5

*

**

***

****

*****

The last

Strive to create examples, attitude determines altitude. Come on, Ollie!