
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A simple python program to print pascal's triangle based on the number of rows entered by the user. The program uses a nested loop structure to print the triangle.
What you will learn
Typology: Essays (university)
1 / 1
This page cannot be seen from the preview
Don't miss anything!
#include <stdio.h> int main(int argc, char **argv) { int row, column, i = 0; int userRows; printf("Enter the number of rows: "); scanf("%d", &userRows); // For each row for (row = 1; row <= userRows; row++, i = 0) { // For each column print spaces until first , then print * for(column = 1; column <= userRows - row; column++) { printf(" "); } while (i != 2 * row - 1) { printf(""); i++; } printf("\n"); } return 0; }