In programming, variable is a packet in which we can store data. These packets can be named and referenced and can be used to perform various operations. To perform a mathematical operation, you can declare two variables and perform the operation on them.
Scope of a variable refers to the part of the code where the variable can be used. The scope or accessibility of the variables defined in a program depends on where you have declared it in each program. Any defined variable cannot be accessed beyond its scope.