0 Replies - 232 Views - Last Post: 20 March 2009 - 02:28 PM

#1 atik97   User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Mean of Grouped data items

Posted 20 March 2009 - 02:28 PM

Description:
puts "Enter Number Of Classes"
n=gets.chomp
n=n.to_i
puts "Enter Class Interval"
h=gets.chomp
h=h.to_f
sum_f=0
sum_fx=0
i=0
while i<n:
  i=i+1
  puts "For class "+i.to_s
  puts "Enter lower limit"
  l=gets.chomp
  l=l.to_f
  u=l+h
  puts "Enter frequency"
  f=gets.chomp
  f=f.to_i
  x=(l+u)/2
  fx=f*x
  sum_fx=sum_fx+fx
  sum_f=sum_f+f
end

mean=sum_fx/sum_f
puts "The mean is "+mean.to_s



Is This A Good Question/Topic? 0
  • +

Page 1 of 1