BAITAP_DAY4.docx

Ờ ượ 15 phút 2 mô t bài toán ả a nh p s

This preview shows page 1 - 3 out of 4 pages.

ượ 15 phút 2. Mô t bài toán : a. Nh p s nguyên N>=0, tính S 2 = 2 + 4 + 6 + ... + N b. Nh p s nguyên N>=0, tính S 3 = 1 + 3 + 5 + ... + N 3. G i ý : S d ng vòng l p gi i quy t bài toán : ế Ví d : for ( int i =2 ; i <N ; i = i + 2 )
Image of page 1

Subscribe to view the full document.

1.5 BÀI T P 5 1. Th i l ng: ượ 15 phút 2. Mô t bài toán: Nh p s nguyên n>0, tính t ng các c s n. ướ 3. G i ý: for (int i =1 ; i <= n ; i ++ ) N u n chia h t cho i => i chính là c s c a n => t ng các giá tr c s ế ế ướ ị ướ 1.6 BÀI T P 6 1. Th i l ng: ượ 15 phút 2. Mô t bài toán: Nh p s nguyên N>0, cho bi t N có ph i là s hoàn ch nh hay không ? Bi t s hoàn ế ế ch nh là s có t ng các c s ướ nh h n nó ơ = v i chính nó Ví d : 6 có c ( 1,2,3, ướ 6 ) t ng c = 1+2+3 = 6 -> s 6 là s hoàn ch nh. ướ 3. G i ý: - Nh p n - Tính t ng các c s < n . N u t ng c b ng v i n => k t lu n là s hoàn ch nh ướ ế ướ ế 1.7 BÀI T P 7 1. Th i l ng: ượ 15 phút 2. Mô t bài toán: In ra dãy s gi m d n :100, 95 , 90, 85,………., 5.
Image of page 2
Image of page 3
  • Fall '19

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern