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
Two kinds of line detection are implemented in OpenCV, the Hough Transform and the probabilistic Hough transform. Assume that there are n feature points in an image and that it tak

A: #include // Test to see if pointer hopping is worthwhile. // strlen implemented with usual indexing mechanism. int strlen1( const char str[ ] ) { int i; for( i =


An experiment succeeds twice as often as it fails. Find the chance that in the next six trials there will be at least four successes.

Operation on list - c++ program: Write a program in c to Insert value on list and list iteration. typedef struct item *node_ptr; struct item {                   int e

getting a palindrome using minimum replacement

a palindrome is a string that reads the same from bhote the ends

Project Description: My project is about telephone billing system. This project was my project in my college life. The project is quite easy, i needed C++ programming language..

This assignment builds on Homework 3. The two major modifications are the instruction of pointers and the calculation of mortgage interest rates. Requirements for Project 2:

I have to make a program that allow the user input 10 numbers between 10 and 100 and if the number input is the same than the last number, should appear an error message. I have th