while and nested for added. AND comparison