Ruby Programming Language question, sorry its a little cut off:
def mean(*value)
sum = 0
count = 0.0
for i in value
sum = sum + i
count = count + 1
end
if count==0
return "no argument"
end
return sum/count
end
mean(1,2,3,4,5)
======================================================
SEE OUTPUT
2) Integer, Floating point , String
123 # Fixnumber in decimal
-500 # Negative
0355 # octal
0xAA # hexadecimal
0b0100 # In binary
Thanks, PLEASE COMMENT if there is any
concern.
Ruby Programming Language question, sorry its a little cut off: 1. Write a Ruby function mean that computes the mean value of an arbitrary number of arguments. The program mean (1,2,3,4,5)mean (1) me...
(a) Write a Ruby function mean that computes the mean value of an arbitrary number of arguments. Function calls mean (1,2,3,4,5) mean 3 ,1 ,and "No arguments". (1) and mean should respectively return tion sigma that uses your function mean and computes the standard deviation of an arbitrary of arguments. Function calls sigma (1,2,1,2)sigma (1) and sigma should respectively return1, o, and "No arguments" (Hint: the standard deviation is the square root of (b) Write a Ruby func variance, and...
(b) Write a Ruby function sigma that uses your function mean and computes the standard deviation of an arbitrary number of arguments. Function calls sigma (1,2,1,2) , sigma (1) and sigma should respectively return 1 ,0,and "No arguments". (Hint: the standard deviation is the square root o variance, and variance is the mean value of squares minus the square of the mean value) (c) Write a Ruby function stat that computes and returns the mean value, standard deviation, and the...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....