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
Question: (a) Write short notes on arrays. Extend your answer by putting emphasis on memory allocation. (b) Write a C++ program to input an integer n followed by n real-

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


- Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulati

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

What is the real function of class - to export data? No, Real purpose of a class isn't to export data. Instead, it's to provide services. Class provides a way to abstract behav

how do you declare an integer variable

Memory management by c program: Write a program to memory management in c program unsigned max( unsigned, unsigned );   int BaseMemBlocks::allocBlock( size_t sz )

What are the different types of endless loops? An endless loop can be of two types: i.) A loop that is intentionally designed to go round and round until the condition withi

Develop a C++ program that uses a while to determine the gross pay (in Dollars) for each of several employees. The company pays “straight-time” for the first 40 hours worked by ea