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
Describe problem with Runtime type identification? A: The run time kind identification comes at cost of performance penalty. Compiler maintains class.

how to decode the numerals to string..

A: Something to let your class to grant access to another class or function. Friends may be either classes or functions. Class grants access privileges to its friends. In genera

Specifying a Class: As discussed a class is defined to develop an algorithm and bind it together in a core shell. A class is an abstract data type (ADT).  The binding of dat

I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec


You are required to give C++ implementation of following classes: 1. PropertyCategories 2. Plot 3. Flat 4. House Following is the description of all data member and member funct

how do i print out invalid input?