Triangle with numbers pattern |
PROGRAM :
#include <stdio.h> #include <stdlib.h> int main() { int i, j, n,k; printf("Enter number of lines[height of triangle] : \t"); scanf("%d",&n); for(i=1; i<=n; i++) { for(j=i; j<n; j++) { printf(" "); } for(k=1; k<(i*2); k++) { printf("%d",k); } printf("\n"); } return 0; }
OUTPUT :
C Program to print a triangle with numbers |
No comments:
Post a Comment