Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int a , b , c=0 , i=0 , j;
- cout << "Enter length and width of the matrix" << endl;
- cout << "Length = ";
- cin >> a ;
- cout << "Width = ";
- cin >> b ;
- while (i<a)
- {
- i=i+1;
- j=0;
- cout << endl ;
- while (j<b)
- {
- j=j+1;
- c=c+1;
- if (c%2==1)
- {
- cout << " 0 ";
- }
- else
- {
- cout << " 1 ";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment