Skip to content

Instantly share code, notes, and snippets.

@sagardere
Created June 5, 2018 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagardere/772b2a03459016b06cce4f4d93f0dfbb to your computer and use it in GitHub Desktop.
Save sagardere/772b2a03459016b06cce4f4d93f0dfbb to your computer and use it in GitHub Desktop.
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