Showing posts with label Average of Number Using Hash in Perl. Show all posts
Showing posts with label Average of Number Using Hash in Perl. Show all posts

Wednesday, April 15, 2020

Average of Number Using Hash in Perl

I wrote this program to ask the user to give key of the hash and then the program will accept a series of numbers based on the key values in the hash and compute the sum and the average of the numbers using Perl programming.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, IT projects, school and application development, programming projects, thesis, and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360. My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.


Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/

https://www.unlimitedbooksph.com/



Sample Program Output


Program Listing

# average_numbers_hash.pl # Author : Jake R. Pomperada,MAED-IT,MIT # Date : April 15, 2020 Tuesday 9:12 AM # Location : Bacolod City, Negros Occidental # Email : jakerpomperada@gmail.com # Websites : http://www.jakerpomperada.com # http://www.jakerpomperada.blogspot.com @$number_values=(1..50); my %val_num = (1 => 5, 2 => 10, 3 => 15, 4 => 20, 5 => 25, ); printf("\n"); printf("\tAverage of Number Using Hash in Perl\n"); printf("\n"); printf("\tEnter The Array Size Based on the Key Values (1..5) : "); chomp($num_input=<STDIN>); printf("\n"); for ($a=0; $a<$val_num{$num_input}; $a++) { printf("\tGive Value in Item No. %d: ",$a+1); chomp($number_values[$a]=<STDIN>); $sum+=$number_values[$a]; } $average = ($sum/$a); print("\n"); printf("\tThe total sum is %.2f.\n",$sum); printf("\tThe average is %.2f.",$average); printf("\n\n"); printf("\t\tEnd of Program"); printf("\n\n");