From de4d4e92a64a4cd61ae6db8da41662c88553772a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 26 Oct 2021 09:21:33 +0100 Subject: - Added guest contribution by Karishma Rajput. --- challenge-122/karishma/C/ch-1.c | 28 ---------------------------- challenge-122/karishma/README | 1 + challenge-122/karishma/c/ch-1.c | 28 ++++++++++++++++++++++++++++ guests.json | 1 + 4 files changed, 30 insertions(+), 28 deletions(-) delete mode 100644 challenge-122/karishma/C/ch-1.c create mode 100644 challenge-122/karishma/README create mode 100644 challenge-122/karishma/c/ch-1.c diff --git a/challenge-122/karishma/C/ch-1.c b/challenge-122/karishma/C/ch-1.c deleted file mode 100644 index 0dda717765..0000000000 --- a/challenge-122/karishma/C/ch-1.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -int main() { - int n=0; - int* ptr; - printf("Enter total number of inputs to be entered: "); - scanf("%d", &n); - ptr = (int*)calloc(n, sizeof(int)); - if (ptr == NULL) { - printf("Memory not allocated.\n"); - exit(0); - } - else { - for (int i = 1; i <= n; i++) { - int temp=0; - scanf("%d",&temp); - ptr[i] = temp; - } - printf("\n"); - } - int sum = 0; - for (int j = 1; j <= n; j++) { - sum += ptr[j]; - printf("%d ", sum / j); - } - printf("\n"); - free(ptr); - return 0; -} \ No newline at end of file diff --git a/challenge-122/karishma/README b/challenge-122/karishma/README new file mode 100644 index 0000000000..896eab1d74 --- /dev/null +++ b/challenge-122/karishma/README @@ -0,0 +1 @@ +Solutions by Karishma Rajput. diff --git a/challenge-122/karishma/c/ch-1.c b/challenge-122/karishma/c/ch-1.c new file mode 100644 index 0000000000..0dda717765 --- /dev/null +++ b/challenge-122/karishma/c/ch-1.c @@ -0,0 +1,28 @@ +#include +int main() { + int n=0; + int* ptr; + printf("Enter total number of inputs to be entered: "); + scanf("%d", &n); + ptr = (int*)calloc(n, sizeof(int)); + if (ptr == NULL) { + printf("Memory not allocated.\n"); + exit(0); + } + else { + for (int i = 1; i <= n; i++) { + int temp=0; + scanf("%d",&temp); + ptr[i] = temp; + } + printf("\n"); + } + int sum = 0; + for (int j = 1; j <= n; j++) { + sum += ptr[j]; + printf("%d ", sum / j); + } + printf("\n"); + free(ptr); + return 0; +} \ No newline at end of file diff --git a/guests.json b/guests.json index 6f97e5ebbe..7ec2f10c1e 100644 --- a/guests.json +++ b/guests.json @@ -5,6 +5,7 @@ "eric-cheung" : "Eric Cheung", "frankivo" : "Frank Oosterhuis", "henry-wong" : "Henry Wong", + "karishma" : "Karishma Rajput", "mfoda" : "Mohammad Foda", "orestis-zekai" : "Orestis Zekai", "shawak" : "Shawak", -- cgit