## How do you represent a triangle in C++?

C++ program on determining triangle

- Declare 3 double type variables, each representing one of three sides of a triangle.
- Prompt the user to input a value for the first side, then.
- Set the user’s input to the variable you created representing the first side of the triangle.

## How do you print Pascal triangle?

Algorithm:

- Take a number of rows to be printed, assume it to be n.
- Make outer iteration i from 0 to n times to print the rows.
- Make inner iteration for j from 0 to (N – 1).
- Print single blank space ” “
- Close inner loop (j loop) //it’s needed for left spacing.
- Make inner iteration for j from 0 to i.
- Print nCr of i and j.

**How do you draw a square in C?**

C Program to Draw a Square using Graphics

- #include
- #include
- #include
- main()
- {
- int gd, gm, s;
- gd=DETECT;
- initgraph(&gd, &gm, “C:TCBGI”);

### What is pygame draw rect?

draw. rect(): This function is used to draw a rectangle. It takes the surface, color, and pygame Rect object as an input parameter and draws a rectangle on the surface.

### What is Pascal triangle in C?

Pascal’s triangle is one of the classic example taught to engineering students. All values outside the triangle are considered zero (0). The first row is 0 1 0 whereas only 1 acquire a space in pascal’s triangle, 0s are invisible. Second row is acquired by adding (0+1) and (1+0).

**Is right triangle code in C?**

Logic to print right triangle star pattern Input number of rows to print from user. To iterate through rows run an outer loop from 1 to N with loop structure for(i=1; i<=N; i++) . To iterate through columns run an inner loop from 1 to i with loop structure for(j=1; j<=i; j++) . Inside the inner loop print star.