#include using namespace std; void x1() { for (int i=1; i<=100; i++) if (!(i%3==0 && i%7==0)) cout << i << " "; cout << endl; } //x2 void printPropedia(int num) { for (int i=0; i<=9; i++) cout << i << "x" << num << " = " << i*num << endl; } //x3 void printPropedia() { for (int i=2; i<=9; i++) { printPropedia(i); cout << endl; } } //x4 double maxOfUserInput(int plithos) { double max, inputValue; for (int i=0; i> inputValue; cout << endl; if (i==0 || inputValue>max) max=inputValue; } return max; } //x5 int fibonacci(int n) { if (n==1 || n==2) return 1; int nMinus1=1, nMinus2=1, rVal; for (int i=3; i<=n; i++) { rVal=nMinus1+nMinus2; nMinus2=nMinus1; nMinus1=rVal; } return rVal; } //x6 bool isEven(int i) { return i%2==0; } void prtLastDigitName(int k) { int lastDigit=k%10; switch (lastDigit) { case 0: cout << "Zero"; break; case 1: cout << "One"; break; case 2: cout << "Two"; break; case 3: cout << "Three"; break; case 4: cout << "Four"; break; case 5: cout << "Five"; break; case 6: cout << "Six"; break; case 7: cout << "Seven"; break; case 8: cout << "Eight"; break; case 9: cout << "Nine"; break; } cout << endl; } int main(int argc, char** argv) { //x1(); //printPropedia(5); //printPropedia(); for (int i=1; i<=10; i++) cout << i << " " << (isEven(i)?"even":"odd") << endl; for (int i=1; i<=10; i++) cout << i << " " << fibonacci(i) << endl; for (int i=10; i<=19; i++) prtLastDigitName(i); cout << endl; return 0; }