\( % theorem \newenvironment{pf}{\textbf{Proof.}}{\rule{1ex}{1ex}} \newtheorem{qu}{Question} \newtheorem{thm}{Theorem} \newtheorem{rmk}{Remark} \newtheorem{go}{Goal} \newtheorem{df}{Definition} \newtheorem{prop}{Proposition} \newtheorem{mot}{Motivation} \newtheorem{ex}{Example} \lstnewenvironment{code}{}{} \newcommand{\nc}{\newcommand} %% env \nc{\env}[2]{ \begin{#1} #2 \end{#1} } \nc{\arr}[2]{ \begin{array}{#1} #2 \end{array} } \nc{\arrb}[2]{ \left\{ \begin{array}{#1} #2 \end{array} \right. } \nc{FTC}[3]{ \left[#3\right]^{#2}_{#1} } \nc{\bracs}[1]{ \left[#1\right] } \nc{\brac}[1]{ \left(#1\right) } \nc{\bracp}[1]{ \left\{#1\right\} } \nc{\intd}[4]{\int^{#2}_{#1}\left(#3\right) #4} % shortcut \nc{\Lra}{\Leftrightarrow} \nc{\Ra}{\Rightarrow} \nc{\La}{\Leftarrow} \nc{\C}{\mathbb{C}} \nc{\R}{\mathbb{R}} \nc{\Fc}{\mathcal{C}} \nc{\bds}{\boldsymbol} \nc{\ds}{\displaystyle} % begin end \nc{\bit}{\begin{itemize}} \nc{\eit}{\end{itemize}} \nc{\bcode}{\begin{code}} \nc{\ecode}{\end{code}} \nc{\bsage}{\begin{sageblock}} \nc{\esage}{\end{sageblock}} %pic \nc{\pic}{\includegraphics} \nc{\svg}{\includesvg} \nc{\pica}{\includegraphics[width=100px,height=100px]} \nc{\picb}{\includegraphics[width=150px,height=150px]} \nc{\vs}{\vspace} \nc{\tbf}{\textbf} %arrow \nc{\upa}{\nearrow} \nc{\downa}{\searrow} \nc{\upw}{\rcurvearrowright} \nc{\downw}{\curvearrowright} \)

Review

Today, we will quickly review CS101.

Check 1. Complete a program that prints number 1 to n.

#include<iostream> 
using namespace std; 
int main() {
  int i,n;
  cout <<"Type an ending number which is greater than 1:";;
//
//
//
//
  return 0;
}

Check 2. Make a function g(n) such that

$$ g(n)=1^2+2^2+3^2+\ldots+n^2 $$ using the recursion. Assume \(n\geq1\).

#include<iostream> 
using namespace std; 
int g(int n) {
//
//
//  Complete.
//
//

}

Check 3. Make above function \( g(x)\) without the recursion.

#include<iostream> 
using namespace std; 
int g(int n) {
//
//
//  Complete.
//
//
 return 0;
}

Check 4. Get n inputs (assume integers) and store them into an array. Calculate the average.

#include<iostream> 
using namespace std;
int main() {
  int n=0;
  cout<<"Type the number of items:";
  cin>>n;
//
// 
//
//
//  
  return 0;
}

KWANG KIM