Skip to content

Instantly share code, notes, and snippets.

@lazuee
Created November 26, 2022 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazuee/7cc6b390955fc80472867fd32fc8043c to your computer and use it in GitHub Desktop.
Save lazuee/7cc6b390955fc80472867fd32fc8043c to your computer and use it in GitHub Desktop.
Codechum - Numerical Triangle
#include<stdio.h>
int main() {
int n;
int start = 1;
printf("Enter n: ");
scanf("%d", & n);
for (int row = 1; start <= n; row++) {
for (int column = 1; column <= row; column++) {
printf("%d", start);
start++;
if (start > n) break;
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment