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^tyldG4>Jem-Gmc|wSY6rG|&W=5oQ+DQ~VM~*l)r{A8jQ(3W7dG!54C+Lv&#R-67+rO|M#VzJ`gFYB
zkNbD(c#|Jj{rGu(AE#1f4_zs^6(0@7@lZSxigTg3lj5aRY0KgPs!OOYqZ%GJguIKD
oR94zs^T=kamLpXM)H0$EIXEqSPW}nqap+R2Av%>e=_rKw7f4b4cK`qY
literal 0
HcmV?d00001
diff --git a/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise21/exercise21.c b/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise21/exercise21.c
new file mode 100644
index 0000000..3b8d2b8
--- /dev/null
+++ b/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise21/exercise21.c
@@ -0,0 +1,67 @@
+/*
+Write a C program to left rotate an array by n position.
+How to rotate left rotate an array n times in C programming.
+Logic to rotate an array to left by n position in C program.
+*/
+
+#include
+#define SIZE 10
+
+void printArray(int arr[],int size);
+void rotateArray(int arr[]);
+
+int main(){
+
+ int arr[SIZE];
+ int rotation;
+
+
+ printf("Enter 10 elements in array:");
+ for (int i = 0; i < SIZE; i++)
+ {
+ scanf("%d",&arr[i]);
+ }
+
+ printf("Enter number of times to left rotate:");
+ scanf("%d",&rotation);
+
+ rotation = rotation % SIZE;
+
+ printf("Array before rotation\n");
+ printArray(arr,SIZE);
+
+ for (int i = 0; i < rotation; i++)
+ {
+ rotateArray(arr);
+ }
+
+ puts("");
+
+ printf("Array after rotation\n");
+ printArray(arr,SIZE);
+
+ return 0;
+}
+
+
+void rotateArray(int arr[]){
+ int temp;
+
+ temp = arr[0];
+
+ for (int i = 0; i < SIZE-1; i++)
+ {
+ arr[i] = arr[i+1];
+ }
+
+ arr[SIZE-1] = temp;
+}
+
+
+void printArray(int arr[],int size){
+ for (int i = 0; i < size; i++)
+ {
+ printf("%d ",arr[i]);
+ }
+
+}
\ No newline at end of file
diff --git a/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise22/exercise22 b/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise22/exercise22
new file mode 100755
index 0000000000000000000000000000000000000000..f83fd4149411255ac6f145a30c60aa2a470d884b
GIT binary patch
literal 49720
zcmeI*Ux-vy90%|-`$yM5IAe%uSzgL5EAme$Zo93`rWdd1s^tnI$l=b+U3YN)$elas
zN=pla;4o}#4`IFb)T1E?zQl-wJ5kc=O9ch>knBLg5<+WK)9-iAy*hK%hu$Q<2hKg`
zch0%Ld+z7#_;&G|KY#mYu@I3?Aw&n&7}cZQLYxx@^@LbU)uJlpp`ktIG4q{+Jlb9&
z?cqZs&hs5Dlyby8I?}#G-5+ls6Mjrv5kch@QhLrAk9)d=^Th_~WoYVKe^VTH1&g`u
z5|gc=lm)MtDBK$g=bPK9^R4k$1aWXfkDqUmKcMr;F(-4%acL}^PrRw~^#utiX7_vL
zf&C>5o}12{@E3&h_4)Zu`|}*PmbTn9A!RXlI-N_&bZ#`S;`Z~n=;z}z=fZI~hn~?_
zKG%<_O1XPzWJvBhc;K);-MD_w;2gs(|GjbLW8%L#DNp2Ej`flGc&#dNeZLYCpRw#5A?s=Xox{Gx%KiHyr#%crIKf
z>HekRL5f#UHK;D9y17_zH)qm`&8hKBiefHLQ{{a;JFw&OjgR`@xN`l%K6m@gTd&cW
zL6!HQ?(ST!`r7iZj+bdPrsnizBfUT8;eRh$3qQAyD$nsdcc#|Ut3>Yah4yoJyx=+6
zO>b?YeWeq$h{_98Ie)#XJzw%;_CkRG1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<
z00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y_009U<;J*nRvC6+#
zrC;M#rTb_4-p{HCt86aJm|t@mYih8I1}}=aOY~jgj9KHs(nM`(bm|qJPMS4qsyJ(1
z{i(x>T&LB)(=uB9AvG1VR;otIX07p6v)QD%@AX`o8j9+wDb{IqQmw9E;m;vI`QvW+
zNS)?y>eT~k*~IJ@JURD1U1rQGT`7Haz^q57o}|7tH8DGPNe`-LRvSO+XMRez&;6~I
z3|`O~8~zPCv!Ej5*Jv6?1;Tyc3;zk@{A}T(FYE^ObGq={
zC>P&ViEk*IoN@`RE=|mf=m-26rJ5R^FEt`o^2^Gq^T7kktIn&G&9bReR)+8JT)Btx
zHhZ5K5~A6=N?lj0>l(W5pL%93HA9D+y>}`1^cY=4<2G$*j6eBo{J=f_n6q(j^=r)k8kWKcRTKz700Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|
zfB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY;|fB*y@6M>lj
z|Ghuuw;TL+lixlj+r%~?009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHaf
zKmY;|fB*y_009U<00Izz00bZa0SG_<0uX=z1Rwwb2tWV=5P$##AOHafKmY>&Yk`%|
zixGaom2oL$!LySmWpeDKJW;gWlz7_})A7`JCPg#FgiNG!DTju5eIb0usGZKxRH275
zopRGTZMUM~$bt2T~)zL_dt~y?=Vj*IK
zI$r0;@tr!}=*QE3yj|bNsZ`lRR|@XM$3k%;6pw}Cd?@awcrjJlvRFcO5!Izs!{dgK
r53!QUN_%S_*=p5xr0Rg$M)V;Er=`!yKcNQ>T}m}Xr}8cxg%JM&!N~lX
literal 0
HcmV?d00001
diff --git a/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise22/exercise22.c b/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise22/exercise22.c
new file mode 100644
index 0000000..2daa75d
--- /dev/null
+++ b/codeforwin_c_exercises/array_and_matrix_programming_exercises/exercise22/exercise22.c
@@ -0,0 +1,67 @@
+/*
+Write a C program to right rotate an array by n position.
+How to right rotate an array n times in C programming.
+Logic to rotate an array to right by n position in C program.
+*/
+
+#include
+#define SIZE 10
+
+void printArray(int arr[],int size);
+void rotateArray(int arr[]);
+
+int main(){
+
+ int arr[SIZE];
+ int rotation;
+
+
+ printf("Enter 10 elements in array:");
+ for (int i = 0; i < SIZE; i++)
+ {
+ scanf("%d",&arr[i]);
+ }
+
+ printf("Enter number of times to left rotate:");
+ scanf("%d",&rotation);
+
+ rotation = rotation % SIZE;
+
+ printf("Array before rotation\n");
+ printArray(arr,SIZE);
+
+ for (int i = 0; i < rotation; i++)
+ {
+ rotateArray(arr);
+ }
+
+ puts("");
+
+ printf("Array after rotation\n");
+ printArray(arr,SIZE);
+
+ return 0;
+}
+
+
+void rotateArray(int arr[]){
+ int temp;
+
+ temp = arr[SIZE-1];
+
+ for (int i = SIZE-1; i > 0; i--)
+ {
+ arr[i] = arr[i-1];
+ }
+
+ arr[0] = temp;
+}
+
+
+void printArray(int arr[],int size){
+ for (int i = 0; i < size; i++)
+ {
+ printf("%d ",arr[i]);
+ }
+
+}
\ No newline at end of file