C program to print number pattern 3 Posted by Shrinidhi Katti Get link Facebook X Pinterest Email Other Apps C program to print number pattern 3 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 #include<stdio.h> int main() { printf("The star pattern is:\n"); int i,j,k; for(i=0;i<5;i++) { printf("\n"); k=1; for(j=0;j<5;j++) { if(i<=j) { printf("%d ",k); k++; } else { printf(" "); k++; } } } } Output: Comments
Comments
Post a Comment