Program code: Output: where, int sum=0: A variable can be initialized during the declaration process. This is usually done to…
November 5, 2022