Computer Science, asked by arav2710, 17 days ago

Write a program to accept any four numbers and print their sum and product.

Answers

Answered by ranismita222
2

Answer:

main :: IO ()

main = interact go

where

go :: String -> String

go string = let

nums = map (read :: String->Int) $ take 4 $ words string

in

show [ sum nums, product nums, fromIntegral (sum nums) / 4 ]

Explanation:

I hope it's useful

Thank you

Similar questions