Java program to count the number of pencils for student

Java program to count the number of pencils for student. Thliagar writes with pencils at school and at home. His parents purchased her one pencil while he was in first grade. He required 5 pencils in her second grade, 14 pencils in his third grade, and so on. From the provided standard, how many pencils does he get?

import java.util.Scanner;
public class Main
{
public static void main (String[] args) {
int penc=0;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the student's Standard");
int stan=sc.nextInt();
if(stan<1||stan>12)
{
System.out.println("invalid standard or above 1 and below 12");
}
else
{
for(int i=1;i<=stan;i++)
{
penc+=i*i;
}
System.out.println("Thilagar gets "+penc+" pencils");
}
}
}

Enter the student’s Standard
33
invalid standard or above 1 and below 12