tanasaradu

Untitled

Nov 23rd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,m,a[1001][1001];
  4. int main()
  5. {
  6. int x,y,z;
  7. cin>>n>>m;
  8. x=y=1;
  9. a[1][1]=a[1][2]=1;
  10. for(int i=1;i<=n;i++)
  11. for(int j=1;j<=m;j++)
  12. {
  13. if((i!=1 || j!=1) && (i!=1 || j!=2))
  14. {
  15. z=x+y;
  16. a[i][j]=z;
  17. x=y;
  18. y=z;
  19. }
  20. }
  21. for(int i=1;i<=n;i++)
  22. {
  23. for(int j=1;j<=m;j++)
  24. cout<<a[i][j]<<" ";
  25. cout<<"\n";
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment