'not found: type SparkContext || object apache is not a member of package org

I am trying to write one simple program in Scala but when I use SparkContext in Intellij this is throwing an error. Can someone give me any solution?

Scala 3.1.1

Spark version 3.2.1

Please see the below picture

import org.apache.spark.SparkContext
import org.apache.spark.SparkConf

object Wordcount extends App {
  val sc = new SparkContext("Local[*]","wordcount")

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source