OJ click the "rectangular transpose" and oj click the "rectangular transpose"

Source: Internet
Author: User

OJ click the "rectangular transpose" and oj click the "rectangular transpose"
Describes the input N * N matrix and outputs its transpose matrix. Enter the first behavior integer N (1 ≤ N ≤ 100 ). Next is a matrix of N * N. Output transpose matrix. Sample Input

21 21 2
Sample output
1 12 2
Prompt

 

The Code is as follows:

# Include <iostream> using namespace std; int main () {int N, I, j; int a [100] [100], B [100] [100]; cin> N; for (I = 0; I <N; I ++) for (j = 0; j <N; j ++) cin> a [I] [j]; for (I = 0; I <N; I ++) for (j = 0; j <N; j ++) B [I] [j] = a [N-i-1] [I]; for (I = 0; I <N; I ++) {for (j = 0; j <N-1; j ++) {cout <B [I] [j] <";} cout <B [I] [j] <endl ;} return 0 ;}


 

Running result:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.