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 c++ program to find the sum of 0.123 ? 103 and 0.456 ? 102 and write the result in three significant digits.

In the Byteland country a string "s" is said to super ascii string if and only if count of each charecter in the string is equal to its ascci value in the byteland country ascii co

how to see inbox details of a particular email adress on console

The definition of an object(variable ): We can explain a variable(set memory to the variable) in the following ways. e.g. double salary; int month; When more than o

a program to find the area under curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b.

Use the above problem and have the program print the biggest and smallest sales for each employee for everyday of the month. Program should also find the largest and

The continue statement The continue statement causes the next iteration of the enclosing loop to start. When this is encountered in the loop , the rest of the statements in the

write a program for convert numbers upto 9 to alphabet?Eg.now enter the inputis 666 means output is "0" lphabet

Question: (a) (i) Explain how class members can be accessed when using objects of the class. Use a suitable example to illustrate your answer. (ii) Explain how the privat