Created
June 5, 2018 08:04
-
-
Save sagardere/772b2a03459016b06cce4f4d93f0dfbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I/P: How many rows: 5 | |
O/P: | |
@ 1 1 1 1 | |
2 @ 2 2 2 | |
3 3 @ 3 3 | |
4 4 4 @ 4 | |
5 5 5 5 @ | |
//Logic | |
#include <stdio.h> | |
void main() | |
{ | |
int i,j,iRow; | |
printf("How many rows: "); | |
scanf("%d",&iRow); | |
for ( i = 1; i <= iRow; i++) | |
{ | |
for (j = 1; j <= iRow; j++) | |
{ | |
if(i==j) | |
{ | |
printf("@\t"); | |
} | |
else{ | |
printf("%d\t",i); | |
} | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment