P ự ệ ? gi m n xu ng n n 10 tăng count ả ố

This preview shows page 4 - 5 out of 5 pages.

p: gi m N xu ng: N = N /10 =>tăng count Th c hi n l i vòng l p đ n khi N = 0 thì thoát kh i vòng l p. ế - Output: count 1.11 BÀI T P 11 1. Th i l ng: ượ 15 phút 2. Mô t bài toán: Vi t m t đo n mã gi và v m t l u đ đ gi i bài toánsau ế ư :
Image of page 4

Subscribe to view the full document.

Nh p vào s N (v i N>0).Ki m tra s nguyên d ng N có toàn ch s ch n hay ko? ươ ữ ố 3. G i ý: - D li u input: N - Khai báo count = 0, flag = 0 - Th c hi n vòng l p : number = N MOD 10 => N u number là s l => vi ph m => flag = 1 ế ố ẻ (đánh d u s vi ph m)=> Thoát vòng l p Ng c l i , n u number không là s l =>gi m N xu ng: N = N /10 ượ ế ố ẻ Th c hi n l i vòng l p đ n khi N = 0 thì thoát kh i vòng l p ế - Sau khi thoát vòng l p, n u flag v n = 0 thì Output : N toàn ch s ch n. ế ữ ố
Image of page 5
  • 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