Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
In_lab2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abhijeet Pratap
In_lab2
Commits
df1ce1d5
Commit
df1ce1d5
authored
Aug 26, 2020
by
Abhijeet Pratap
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
parent
94d60d9d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
q4.sh
q4.sh
+27
-0
No files found.
q4.sh
0 → 100644
View file @
df1ce1d5
#!/bin/bash
file_name
=
$(
<
$*
)
file_name
=(
$(
for
each
in
${
file_name
[@]
}
;
do
echo
$each
;
done
|
sort
)
)
count
=
0
sum
=
0
for
values
in
"
${
file_name
[@]
}
"
;
do
sum
=
$((
sum
+
values
))
count
=
$((
count+1
))
done
avg
=
$((
sum
/
count
))
echo
$avg
remainder
=
$((
$count
%
2
))
mid
=
$((
count/2
))
if
[
$remainder
-eq
0
]
then
echo
${
file_name
[
$mid
]
}
else
median_sum
=
$((
(
${
file_name
[
$mid
]
}
+
${
file_name
[
$((
mid+1
))
]
}
)/
2
))
echo
$median
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment