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
write a program for convert numbers upto 9 to alphabet?Eg.now enter the inputis 666 means output is "0" lphabet

one of the applications of computers in numerical analysis is computing the area under a curve. one method of calculating the area under acurve is to divide the area int a number o

recsection method source code for searching position

Problems With Multiple Inheritance The following example presents a problem with multiple inheritance. class Aclass  {   public :  void put()

Write a simple generic version of method isEqualTo that compares its two arguments with the equals method and returns true if they are equal and false otherwise. Use this generic m


Create a mathematical number guessing game. Have the user prompt for the number of games that they want to play. Then each game consists of the following rules. a. The computer

Program to design list in c: Write a program in c to insert the values in list void main() { int i=0; char a[20]; clrscr(); printf("Enter the line\n");


Write a C function to solve the system of linear equations A x = y where A is an N by N matrix in the format of pointer-to-pointers and y is a vector in the format of a pointer. Th