A loop statement allows the programmer to execute a statement or group of statements multiple number of times, based on…