Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hackerrank/problem solving/day of the programmer
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions hackerrank/problem solving/encryption
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include<stdlib.h>

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(" ");
}
Expand Down