Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n, k;
- int n1, n2, k1, k2;
- printf("Please enter n, k: ");
- scanf("%d%d", &n, &k);
- /* print n chess lines */
- for (n1 = 0; n1 < n; ++n1)
- {
- /* repeat one line k times */
- for (k1 = 0; k1 < k; ++k1)
- {
- /* print n cells */
- for (n2 = 0; n2 < n; ++n2)
- {
- /* draw a cell */
- for (k2 = 0; k2 < k; ++k2)
- {
- if ((n1 + n2) % 2) putchar('#');
- else putchar(' ');
- }
- }
- putchar('\n');
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment