coutENTER ELEMENTS FOR 3D ARRAY n for int i 0 i X i for int j 0 j Y j for int k

Coutenter elements for 3d array n for int i 0 i x i

This preview shows page 17 - 19 out of 19 pages.

cout<<"ENTER ELEMENTS FOR 3D ARRAY \n"; for (int i = 0; i < X; i++) for (int j = 0; j < Y; j++) for (int k = 0; k < Z; k++) cin>>ptr[i][j][k] ; cout<<"YOUR 3D ARRAY IS \n"; for (int i = 0; i < X; i++) { for (int j = 0; j < Y; j++) {
Image of page 17
for (int k = 0; k < Z; k++) cout << ptr[i][j][k]<<" " ; } cout << endl; } delete[] ptr; ptr=NULL; system("pause"); return 0; } QUESTION 9: #include <iostream> using namespace std; int fibonacci( int n ) { if (( n == 1) || ( n == 0)) { return ( n ); } else {
Image of page 18
return (fibonacci( n - 1) + fibonacci( n - 2)); } } int main() { int n, i = 1; cout << "ENTER YOUR NUMBER FOR FIBONACCI SERIES :" ; cin >> n; cout << "FIBONACCI SERIES : \n" ; while (i<=n) { cout << " " << fibonacci(i); i++; } cout << endl; system( "pause" ); }
Image of page 19

You've reached the end of your free preview.

Want to read all 19 pages?

  • Fall '17
  • bilal
  • Void type, Carriage return, int sum

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture