Sdustoj Print Letter Diamond pattern

Source: Internet
Author: User

Problem B: Print letter Diamond pattern Time limit: 1 Sec Memory Limit: MB
Submit: 2530 Solved: 1769
[Submit] [Status] [Web Board] Description

Output n (odd n) lines consist of letters of the Diamond, the 1th act the letter A, the 2nd Act BCD, the third act CDEFG, and so on. The diamond is symmetrical up and down.

Input

An odd n. 0<n<18.

Output

A diamond pattern consisting of n-line letters.

Sample Input7Sample OutputABCDCDEFGDefghijCDEFGBCDAHintappend Code

In fact, the simple pyramid output, only different when the first letter of each line has changed, so as long as the focus on this point is good.

1#include <stdio.h>2#include <math.h>3#include <string.h>4#include <ctype.h>5 intMain ()6 {7     intm;8scanf"%d",&m);9     inti,j;Ten     intK; One      for(j=0;j< (m+1)/2; j + +) A     { -      for(i=0;i< (m+1)/2-1-j;i++) -printf" "); the        for(k=j;k<j*3+1; k++) -printf"%c",'A'+k); -printf"\ n"); -     } +      for(J= (m+1)/2-2; j>=0; j--) -     { +          for(I= (m+1)/2-2-j;i>=0; i--) Aprintf" "); at          for(k=j;k<j*3+1; k++) -printf"%c",'A'+k); -printf"\ n"); -     } -   -}

Sdustoj Print Letter Diamond pattern

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.