Challenge: Initialize a Variable and Overwrite its Value

Test your understanding by solving a simple challenge.

We'll cover the following

Problem statement

In this challenge, your task is to:

  • Declare a variable: int var
  • Initialize var to 5000
  • Print the value of the var
  • Overwrite the value of var to 1000
  • Print the value of the var again in the new line

Output

Your code should have the following output.

var = 5000
var = 1000

📝Note: Please print the output in this format; otherwise, your code will not pass the test case.

Coding exercise

Before diving directly into the solution, try to solve it yourself. Then, check if your code passes all the test cases.

Good luck! 👍

Get hands-on with 1400+ tech skills courses.