Menu
Coddy logo textTech

Recap - Calculations

Part of the Fundamentals section of Coddy's GO journey — lesson 21 of 109.

challenge icon

Challenge

Easy

Complete the code to perform various arithmetic operations and display the results.

Try it yourself

package main

import "fmt"

func main() {
  // Given variables
  a := 10
  b := 3
  
  // TODO: Calculate and store the sum of a and b in a variable named 'sum'
  
  // TODO: Calculate and store the difference (a - b) in a variable named 'difference'
  
  // TODO: Calculate and store the product of a and b in a variable named 'product'
  
  // TODO: Calculate and store the result of a divided by b in a variable named 'quotient'
  
  // TODO: Calculate and store the remainder when a is divided by b in a variable named 'remainder'
  
  // Print the results
  fmt.Println("Sum:", sum)
  fmt.Println("Difference:", difference)
  fmt.Println("Product:", product)
  fmt.Println("Quotient:", quotient)
  fmt.Println("Remainder:", remainder)
}

All lessons in Fundamentals