Pattern

C Program For Generate The Pattern Source Code: #include<stdio.h> #include<conio.h> void main() { int i,j,k,n; int a=1; clrscr(); printf("enter the no. of rows:"); scanf("%d",&n); for(i=1;i<=n;i++) { for(j=0;j<=2*i;j++) printf(" "); for(k=0;k<=n-i;k++) { printf(" %d ",a); a++; } printf("\n"); } getch(); } output: enter the no. of rows:4 1 2 3 4 5 6 7 8 9 10

Share:

0 comments