Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

Write a program for adding two variable

  1. User

    Write a program for adding two variable

  2. Assistant

    Sure, here is a program in Python that adds two variables together:

    # Step 1: Declare and assign values to the variables
    num1 = 10
    num2 = 5
    
    # Step 2: Add the two variables together
    sum = num1 + num2
    
    # Step 3: Print the sum
    print("The sum of", num1, "and", num2, "is:", sum)
    

    This program declares two variables num1 and num2 with values 10 and 5 respectively. It then adds the two variables together and stores the result in the sum variable. Finally, it prints the sum using the print() function.