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
write a cprogram to calculate fraction through recursion

A: The simplest way is to use a stringstream: #include #include #include using namespace std; string itos(int i) // convert int to string { stringstream s;

Define External Storage Class - computer programming? When a variable is declared outside a function the storage is permanently assigned to it and its storage class is 'extern'

a) Define an Asset base class that provides the following method: class Asset { public:      virtual double getValue()=0; };   This will be the base class for both stock an

smugglers transfer the messages from one to another by using the mobile

C program to remove vowels in sentence : void main() {                 char  str[100];                 int n;                 printf("enter string\n");

A skilled programmer is required to build a standalone module to extract, parse and store in database tables, word count data from web pages and RSS feeds. The module will take

The digital signal is one which only consists of two states i.e. logic '1'   (+5 volts) and logic '0' (0 volts). Various electronic blocks use logic and these form the basis of a m

C Program for FUNCTION OF FIND THE FACTORIAL float factorial(float); void main() {           float i=0,c=0;           clrscr();           printf("ENTER THE DIGI

Call by Reference Passing variables(parameters) to a function in C can be done in two ways - pass by value, also called as call by value and pass by address or also known as ca