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
#questiStarting with a blank solution, write a program to prompt the user for an employee number, hourly rate and hours worked. Compute and display the employee number, gross weekl

Define Bitwise Left Shift and Right Shift Operators: >? The bitwise shift operators shift their first operand right (>>) or left ( // Illustration of the bitwise right shi

given number is prime or not

The ability to verify at run time the type of an object by using the typed operator or the dynamic_cast operator.

What is the purpose of return values? Can you not return any values from a function? If you could what would he function look like?

how to write a c program for stone game

What is the difference between = symbol and == symbol? - The = symbol is generally used in mathematical operations. It's used to assign a value to a given variable whereas the

Question : (a) Define a Pointer. Provide an example of an integer pointer variable. (b) Give advantages of using pointers over arrays. (c) Declare an integer pointer

Ask queCreate an object oriented application with C# that computes the area of a rectangle, and the area and the volume of a cuboid. Based on the inheritance concept, create a bas

Write a C program to compute the factorial of  5 i.e 1x2x3x4x5 etc #include stdio.h   void main()   {   char promt;      int factor;   factor = 1*2*3*4*5;   printf("The fac