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

C program to print R diagonal triangle:

#define rows 3

#define cols 3

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==2)

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

                                                else

                                                                printf("   ");

                                }

                                                printf("\n");

                }

 

 

}

 

 

Posted Date: 9/29/2012 7:19:48 AM | Location : United States







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

Write discussion on C program to print r diagonal triangle
Your posts are moderated
Related Questions
# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..




how to write c code to solve assignment problem?

Hello I''m new to programming, and I''m making now my 1st program. My question is how to put substr in textbox that question mark should be at the end of sentence? And 2nd question

a program to determine whether a number is an odd or even using recursive function

A: In C++ there is a main difference among a template and a macro. Merely a macro is a string which the compiler replaces along with the value that was defined. For example #define

c program of double linked list with full explanation

Program1: Write a program to find the factorial of a given number. The input is user given. Final output is printed out on to the screen. Program2: Write a program to gene