i just learnt about arrays and am good at maths so i wrote two simple progs that calculate squares and the fibonacci numbers here they are
Code:#include <iostream> using namespace std; int main() { int i; int fib[20]; fib[0] = 1; fib[1] = 1; for (i = 2; i < 20; i++) { fib[i] = fib[i-1] + fib[i-2]; } for (i = 0; i < 20; i++) { cout << "The " << i+1 << " element is " << fib[i] << endl;cin.get(); } return 0; }