#include <stdio.h>
// Function prototype
void printPattern(int n);
int main() {
// Variable to store user input
int n;
// Prompt user for input
printf("Enter a number: ");
// Read user input
scanf("%d", &n);
// Call the function to print the pattern
printPattern(n);
return 0;
}
// Function to print the pattern
void printPattern(int n) {
// Outer loop to iterate through rows
for (int i = 1; i <= n; i++) {
// Inner loop to iterate through columns
for (int j = 1; j <= i; j++) {
// Print the current column number
printf("%d ", j);
}
// Move to the next line after each row
printf("\n");
}
}