Typical C language questions: Yang Hui triangle and Yang Hui triangle

Source: Internet
Author: User

Typical C language questions: Yang Hui triangle and Yang Hui triangle

Typical C language questions c34 Yang Hui triangle

/* [Procedure 34] Yang Hui triangle * Subject: print Yang Hui triangle first 10 rows 1 1 1 1 2 1 1 3 1 1 1 4 6 4 1 1 1 5 10 5 1 1 6 15 15 15 6 1 1 7 21 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1 * program analysis: 1) The number of endpoints is 1.2.) Each number is equal to the sum of the two above. 3) The numbers in each row are symmetric between the left and right, and gradually increase from 1. 4) There are n numbers in the nth row. 5) The number in line n is 2n-1. 6) Each number is equal to the sum of the left and right numbers in the previous row. 7) a number equal to (flaot) (number of rows-(number of columns-1)/(number of columns-1) * (number of the previous column) # include

 
  
# Define N 10int main (int argc, char * argv []) {int I, j, k, yh; float num; for (I = 0; I

  

  

 

Related Article

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.