From 4469d932218a830d56634c1f32315a36d25394ef Mon Sep 17 00:00:00 2001 From: pranu2502 <52481227+pranu2502@users.noreply.github.com> Date: Wed, 30 Sep 2020 16:19:32 +0530 Subject: [PATCH 1/2] Update day of the programmer --- hackerrank/problem solving/day of the programmer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackerrank/problem solving/day of the programmer b/hackerrank/problem solving/day of the programmer index a47cd39..2a56fbb 100644 --- a/hackerrank/problem solving/day of the programmer +++ b/hackerrank/problem solving/day of the programmer @@ -29,7 +29,7 @@ int main(){ printf("26.09.1918"); } (y<1919) ? (out = julian(y)) : (out = georgian(y)); - + //The above and below lines are ternary operators, it is basically if else in a single line (out==1) ? (printf("12.09.%d" , y)) : (printf("13.09.%d" , y)); return 0; From 54a98c82aa88bd046b97eb4cb384a3dc517c0804 Mon Sep 17 00:00:00 2001 From: pranu2502 <52481227+pranu2502@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:52:33 +0530 Subject: [PATCH 2/2] Update encryption --- hackerrank/problem solving/encryption | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hackerrank/problem solving/encryption b/hackerrank/problem solving/encryption index 0d39e5f..3d946d9 100644 --- a/hackerrank/problem solving/encryption +++ b/hackerrank/problem solving/encryption @@ -4,13 +4,13 @@ #include int main(){ - char* s = (char *)malloc(10240 * sizeof(char)); - scanf("%s",s); + char* s = (char *)malloc(10240 * sizeof(char)); + scanf("%s",s); //Taking string inputs int len = strlen(s); int columns = ceil(sqrt(len)); - for(int i = 0; i < columns; i++) { - for(int j = i; j < len; j += columns) { - printf("%c", s[j]); + for(int i = 0; i < columns; i++) { //iterating through columns + for(int j = i; j < len; j += columns) { //iterating through strings + printf("%c", s[j]); //printing the answer } printf(" "); }