Factorial.cpp: #include using namespace std; int main() { int n, factorial = 1; cout << "Enter a positive integer: "; cin >> n; for (int i = 1; i <= n; ++i) { factorial *= i; // factorial = factorial * i; } cout<< "Factorial of "< using namespace std; int main() { int a[2][3] = { {5,10,20}, {8,6,5} }; int b[2][3]= { {3,8,5}, {2,9,3} }; int i,j,s[2][3]; for(i=0;i<2;i++) { for(j=0;j<3;j++) { cout << a[i][j] + b[i][j] << " "; } cout << endl; } return 0; } PrimeNumbers.cpp: #include using namespace std; int main () { int i, j; for(i = 2; i<100; i++) { for(j = 2; j <= (i/j); j++) if(!(i%j)) break; // if factor found, not prime if(j > (i/j)) cout << i << " is prime\n"; } return 0; } RocketCountdown.cpp: #include using namespace std; int main () { int n = 10; for (int i=10; i > 0 ; i--) { cout << n << ", "; --n; } cout << "liftoff!\n"; } SimpleLoop.cpp: #include using namespace std; int main() { for (int i = 0; i < 5; i++) cout << i << endl; return 0; } ThreeVariables.cpp: #include using namespace std; int main () { for( int a = 1, b = 10, c = 1 ; a < 10; a = a + 1, b = b - 1, c = c * 2 ) { cout << "value of a: " << a << endl; cout << "value of b: " << b << endl; cout << "value of c: " << c << endl; } return 0; }