DreamsCoder.com

We Code your Dreams


home > Displaying Matrix in C




Displaying Matrix in C









#include
#include

void main()
{
int i,j,a=4,b=0;
clrscr();

for(i=0;i<5;i++)
{
	for(j=0;j<5;j++)
	{
	if(i>=j)
	printf(" +1");
	if(j>=i)
	printf(" -1");
	if(i==b&&j==a)
	{
	printf(" 0");
	a--;
	b++;
	}
	}//inner for
	printf("\n");
}//outer for
getch();
}           //main

Label - c





by - Chinmay Mahajan





Are you looking for something else?


Suggested Programs




Spinning letters in using C - graphics


Pascal triangle program in C language


What is the difference between ARRAY and STACK?


Pascal triangle program in C language