Very Good Pattern to Practice in C++.

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int n, i, j, k, a[3][3]={{1,2,3},{4,5,6},{7,8,9}}, b[3][3];
cout<<"Actual Values....\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
//Processing Loop
cout<<"After Processing\n";
for(i=0;i<3;i++)
{
for(j=0,k=2;j<3;j++,k--)
{
b[i][j]=a[k][i];
cout<<b[i][j]<<" ";
}
cout<<endl;
}
}



No comments

Post your comments

Powered by Blogger.