-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreversedRightAngledTriangle.go
More file actions
46 lines (39 loc) · 1.1 KB
/
reversedRightAngledTriangle.go
File metadata and controls
46 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
)
func main(){
var num int = 5
printReversedRightAngledTriangle(num)
}
func printReversedRightAngledTriangle(num int){
for row := 0;row <= num;row++{
for col := num; col >= row;col--{
fmt.Print("*")
}
fmt.Println()
}
}
//PSEUDOCODE
BEGIN
// Define the main function
FUNCTION main()
// Declare and initialize the variable 'num' with the value 5
num = 5
// Call the function to print the reversed right-angled triangle
CALL printReversedRightAngledTriangle(num)
END FUNCTION
// Define the function to print the reversed right-angled triangle
FUNCTION printReversedRightAngledTriangle(num)
// Loop through each row from 0 to 'num'
FOR row = 0 TO num
// Loop through each column from 'num' down to the current row
FOR col = num DOWNTO row
// Print an pattern
PRINT "*"
END FOR
// Move to the next line after printing the stars for the current row
PRINT newline
END FOR
END FUNCTION
END