C program to reverse the elements of array, C/C++ Programming

C program to reverse the elements of array:

#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=rows-1;i>=0;i--)

                {

                                printf("\t");

                                for(j=0;j<=cols-1;j++)

                                {

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

                                                }

                                                printf("\n");

                }

 

 

}

 

 

Posted Date: 9/29/2012 7:20:46 AM | Location : United States







Related Discussions:- C program to reverse the elements of array, Assignment Help, Ask Question on C program to reverse the elements of array, Get Answer, Expert's Help, C program to reverse the elements of array Discussions

Write discussion on C program to reverse the elements of array
Your posts are moderated
Related Questions
Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Program is to define a class as employee: Write a program to define a class as employee and collect information about them by using classes and object class employee   {

Write a program that accepts two real numbers from a user and a select code. If the entered select code is 1, have the program add the two previously entered numbers and display t

(a) Write a procedure called (mult x y) that multiplies two numbers x and y in a recursive manner using successive addition. Specifically, note that a x b = a + a + .... + a (b tim

Class Templates In addition to function  templates, C++  also supports the  method of class templates. By definition, a class template is a class definition that explains a fam


assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

give an example of function

Aim: To implement a program to add two polar coordinates using operator overloading. Code:                       #define PI 3.14 class polar {             double