From ac21b50a13a2cfb0efee1a452c9b1cca729796eb Mon Sep 17 00:00:00 2001 From: msulthon <59869908+msulthon@users.noreply.github.com> Date: Thu, 23 Jan 2020 18:22:54 +0700 Subject: [PATCH 1/2] Update main.cpp --- main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index f439d60..7966f42 100644 --- a/main.cpp +++ b/main.cpp @@ -4,9 +4,9 @@ using namespace std; /** WRITE DOWN YOUR INFORMATION HERE */ -string name = ""; // put your name here -string ID = ""; // put your student id here -int group_id = 0; // your Group Number here (1-8) +string name = "Muhammad Sulthon Asramanggala"; // put your name here +string ID = "1301194008"; // put your student id here +int group_id = 2; // your Group Number here (1-8) /** FUNCTIONS LIST, DO NOT MODIFY THESE */ @@ -150,7 +150,7 @@ string count_and_sum(int arr[], int n) { // YOUR CODES HERE //----------------------- - + //----------------------- return ""; From 20985303b967b8537f3b0e932bb87ff7fbdb5d9c Mon Sep 17 00:00:00 2001 From: msulthon <59869908+msulthon@users.noreply.github.com> Date: Fri, 24 Jan 2020 21:25:18 +0700 Subject: [PATCH 2/2] Update main.cpp m.sulthon 1301194008 --- main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 7966f42..8b6fce6 100644 --- a/main.cpp +++ b/main.cpp @@ -166,7 +166,19 @@ string group_and_average(int arr[], int n) { // YOUR CODES HERE //----------------------- - + int jumlah ; + float average ; + for (int i = 0; i < n; i++) { + if ( arr[i]%i == 0 ) { + for ( int j = i;j < (n-1); j++){ + arr[j] = arr [j+1]; + } + } + jumlah = jumlah + arr [i] + } + average = jumlah/n + + //----------------------- return "";