├── README.md ├── pattern1.c ├── pattern10.c ├── pattern2.c ├── pattern3.c ├── pattern4.c ├── pattern5.c ├── pattern6.c ├── pattern7.c ├── pattern9.c └── s_pattern.c /README.md: -------------------------------------------------------------------------------- 1 | # Pattern -------------------------------------------------------------------------------- /pattern1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j; 5 | for(i=0;i<=5;i++) 6 | { 7 | for(j=1;j<=i;j++) 8 | { 9 | printf("%d",j); 10 | } 11 | printf("\n"); 12 | } 13 | } 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | // output::1 25 | // 12 26 | // 123 27 | // 1234 28 | // 12345 29 | -------------------------------------------------------------------------------- /pattern10.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j; 5 | for(i=5;i>=1;i--) 6 | { 7 | for(j=1;j 2 | int main() 3 | { 4 | int i,j; 5 | for(i=1;i<=5;i++) 6 | { 7 | 8 | for(j=0;j<=i;j++) 9 | { 10 | printf("hii there\n"); 11 | } 12 | } 13 | printf("\n"); 14 | } 15 | 16 | 17 | 18 | output:: 19 | hii there 20 | hii there 21 | hii there 22 | hii there 23 | hii there 24 | hii there 25 | hii there 26 | hii there 27 | hii there 28 | hii there 29 | hii there 30 | hii there 31 | hii there 32 | hii there 33 | hii there 34 | hii there 35 | hii there 36 | hii there 37 | hii there 38 | hii there 39 | 40 | -------------------------------------------------------------------------------- /pattern3.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j; 5 | for(i=1;i<=5;i++) 6 | { 7 | for(j=1;j<=i;j++) 8 | { 9 | printf("%d",i); 10 | } 11 | printf("\n"); 12 | } 13 | } 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | output:: 23 | 1 24 | 22 25 | 333 26 | 4444 27 | 55555 28 | 29 | -------------------------------------------------------------------------------- /pattern4.c: -------------------------------------------------------------------------------- 1 | // print the pattern 2 | 3 | #include 4 | int main() 5 | { 6 | int i,j; 7 | for(i=5;i>=1;i--) 8 | { 9 | for(j=i;j>=1;j--) 10 | { 11 | printf("%d",i); 12 | } 13 | printf("\n"); 14 | } 15 | } 16 | 17 | 18 | 19 | 20 | 21 | output:: 22 | 55555 23 | 4444 24 | 333 25 | 22 26 | 1 27 | 28 | -------------------------------------------------------------------------------- /pattern5.c: -------------------------------------------------------------------------------- 1 | //print the pattern 2 | 3 | #include 4 | int main() 5 | { 6 | int i,j; 7 | for(i=5;i>=1;i--) 8 | { 9 | for(j=i;j>=1;j--) 10 | { 11 | printf("%d",j); 12 | } 13 | printf("\n"); 14 | } 15 | } 16 | 17 | 18 | output:: 19 | 54321 20 | 4321 21 | 321 22 | 21 23 | 1 24 | 25 | -------------------------------------------------------------------------------- /pattern6.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | int main() 5 | { 6 | int i,j; 7 | for(i=1;i<=5;i++) 8 | { 9 | for(j=5;j>=i;j--) 10 | printf(" "); 11 | for(j=1;j<=i;j++) 12 | printf("%d",j); 13 | 14 | printf("\n"); 15 | 16 | } 17 | } 18 | 19 | 20 | output:: 21 | 1 22 | 12 23 | 123 24 | 1234 25 | 12345 26 | 27 | -------------------------------------------------------------------------------- /pattern7.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j; 5 | for(i=1;i<=5;i++) 6 | { 7 | for(j=5;j>=i;j--) 8 | printf(" "); 9 | for(j=1;j<=i;j++) 10 | printf("%d",i); 11 | 12 | printf("\n"); 13 | 14 | } 15 | } 16 | 17 | 18 | //output:: 19 | 1 20 | 22 21 | 333 22 | 4444 23 | 55555 24 | 25 | -------------------------------------------------------------------------------- /pattern9.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j; 5 | for(i=5;i>=1;i--) 6 | { 7 | for(j=1;j 2 | int main() 3 | { 4 | int i,j; 5 | for(i=5;i>=1;i--) 6 | { 7 | for(j=1;j