Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //code to print NxN cross using '*'
- #include<stdio.h>
- int main(){
- int n, i, j;
- scanf("%d", &n);
- for (i = 0; i < n; i++) {
- for (j = 0; j < n; j++) {
- if (i == j || i + j == n-1) {
- printf("*");
- }
- else {
- printf(" ");
- }
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment