Siemens Interview Question

Asked to make a code & run