This program draws Pascal's triangle using nested for loops. The user inputs the number of rows, n, and then the program uses three for loops to print the appropriate number of spaces and asterisks to create each row of the triangle. The innermost loop prints asterisks, the middle loop prints spaces, and the outer loop controls iterating through each row from 1 to n.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
290 views2 pages
Tugas Segitiga Pascal
This program draws Pascal's triangle using nested for loops. The user inputs the number of rows, n, and then the program uses three for loops to print the appropriate number of spaces and asterisks to create each row of the triangle. The innermost loop prints asterisks, the middle loop prints spaces, and the outer loop controls iterating through each row from 1 to n.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
FLOWCHART SEGITIGA PASCAL ( * )
PROGRAM SEGITIGA PASCAL ( * )
Uses crt; Var j,k,l,n: integer; Begin Write(masukkan jumlah n : ); readln(n); For j:=1 to n do Begin For k:=j to n do Begin Write( ); End; For l:=1 to x do Begin Write(* ); End; Writeln; End; Readln; End.