A computer is an electronic device that can be programmed to perform mathematical and logical operations automatically. It works by accepting digital input, processing that input according to programmed instructions, storing and retrieving data, and producing useful output. Modern computers are versatile machines that can be programmed to carry out almost any task from complex scientific calculations to simple tasks like word processing.