C program to print l diagonal triangle, C/C++ Programming

C program to print L diagonal triangle:

void main()

{

                int i=0,j=0;

                int arr[rows][cols];

                for (i=0; i<=rows-1; i++)

                                for(j=0;j<=cols-1;j++)

                                {

                                                printf("Enter elements (%d,%d)\n",(i+1),(j+1));

 

                                                scanf("%d",&arr[i][j]);

                                }

                for (i=0; i<=rows-1; i++)

                {

                                printf("\t");       

                                for(j=0;j<3;j++)

                                                {

                                                printf("%d  ",arr[i][j]);

                                                }

                                                printf("\n");

                }

                printf("\n Revers of matrix\n");

                for(i=0;i<=rows-1;i++)

                {

                                printf("\t");

                                for(j=0;j<=cols-1;j++)

                                {

                                                if(i==j)

                                                printf("%d  ",arr[i][j]);

                                                else

                                                                printf("   ");

                                }

                                                printf("\n");

                }

 

 

}

Posted Date: 9/29/2012 7:17:07 AM | Location : United States







Related Discussions:- C program to print l diagonal triangle, Assignment Help, Ask Question on C program to print l diagonal triangle, Get Answer, Expert's Help, C program to print l diagonal triangle Discussions

Write discussion on C program to print l diagonal triangle
Your posts are moderated
Related Questions

#C Why don''t online compilers support the header file? What can I do to resolve this? PS. I have tried , does''nt work either. Thannk in advance.


Program is to read the contents of a file: void main()    {   ifstream fin("ascii.txt");   char ch;   while(! fin.eof())     {   fin>>ch;   cout     }

#write code for rotation in c

What are  P r im a r y D a t a T y p es? Integer can be defined according to the size of the data and it can be modified further by using keyword unsigned and si

Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit signed in


Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

how to make a diamond from steric