From 5f9ca2cdb56ebb394389833f06ff4fbe70a1ca0c Mon Sep 17 00:00:00 2001 From: Komal Gupta Date: Tue, 25 May 2021 11:33:26 +0530 Subject: [PATCH 1/2] Create number_half_pyramid.cpp --- patterns/number_half_pyramid.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 patterns/number_half_pyramid.cpp diff --git a/patterns/number_half_pyramid.cpp b/patterns/number_half_pyramid.cpp new file mode 100644 index 0000000..ea8bd04 --- /dev/null +++ b/patterns/number_half_pyramid.cpp @@ -0,0 +1,34 @@ +/*to print +input=6 +output= +1 +12 +123 +1234 +12345 +123456 +*/ +#include +void main() +{ + int a,b,c,rows; + printf("Enter the number of rows: "); + scanf("%d", &rows); + for(a=1;a<=rows;a++) + { + for(b=rows-1;b>a;b--) + { + printf(" "); + } + printf("\n"); + for(c=1;c<=a;c++) + { + printf("%d",c); + + + } + } +} + + + From 4d9d3455cee832d859792ce58505d6f2af794b50 Mon Sep 17 00:00:00 2001 From: Komal Gupta Date: Tue, 25 May 2021 11:59:58 +0530 Subject: [PATCH 2/2] Create Transpose_of_matrix.cpp --- Matrix_programs/Transpose_of_matrix.cpp | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Matrix_programs/Transpose_of_matrix.cpp diff --git a/Matrix_programs/Transpose_of_matrix.cpp b/Matrix_programs/Transpose_of_matrix.cpp new file mode 100644 index 0000000..05b8a1b --- /dev/null +++ b/Matrix_programs/Transpose_of_matrix.cpp @@ -0,0 +1,52 @@ +/* +Enter size of matrix-->3 + + Enter the elements of the array +4 7 0 +2 5 8 +4 3 8 + + Matrix is + 4 7 0 +2 5 8 +4 3 8 + + Tranpose of the matrix is + 4 2 4 +7 5 3 +0 8 8 +*/ +#include + +void main() + +{ + int a[20][20],i,j,n; + printf("Enter size of matrix-->"); + scanf("%d",&n); + printf("\n Enter the elements of the array \n"); + for(i=0;i