Bài tập: Viết 1 hàm isArmstrong(n) nhằm kiểm tra một số ít nguyên dương n liệu có phải là số Armstrong tuyệt không, sau đó liệt kê toàn bộ các số Armstrong bao gồm 3, 4 chữ số.
Bạn đang xem: Số amstrong là gì
Hàm isArmstrong(n) trả về 1 trường hợp n là số Armstrong, trái lại hàm trả về 0
#include #include #include int isArmstrong(int n){ int tong=0, dem=0, tam=n; //Xác định xem số nguyên n bao gồm bao nhiêu chữ số //và giữ vào trở nên dem bởi vì dem++; while (tam/=10); //Tính tổng lũy thừa của các chữ số tam=n; bởi vì tong+=pow((tam%10),dem); while ((tongKết quả chạy chương trình
Share this:
Like this:
Like Loading...
Related
Comments (0)Trackbacks (0)Leave a commentTrackback
No comments yet.No trackbacks yet.
Leave a Reply Cancel reply
Enter your bình luận here...
Fill in your details below or click an icon to lớn log in:

Email (required) (Address never made public)
Name (required)
Website

You are commenting using your orsini-gotha.com.com account.(LogOut/Change)

You are commenting using your Google account.(LogOut/Change)

You are commenting using your Twitter account.(LogOut/Change)

You are commenting using your Facebook account.(LogOut/Change)
Cancel
Connecting to lớn %s
Notify me of new comments via email.
Notify me of new posts via email.
Δ
Beginning C# 2005DatabasesSố trả hảo
RSS feed
Chuyên mục
Các bài bác mới đăng
Các bài được coi như nhiều
Website liên kết
Meta
Lưu trữ
Các link được click nhiều
NoneLượt truy tìm cập
282,058 lượtTop
Create a không lấy phí website or blog at orsini-gotha.com.com.
Privacy và Cookies: This site uses cookies. By continuing khổng lồ use this website, you agree khổng lồ their use. Khổng lồ find out more, including how khổng lồ control cookies, see here:Cookie Policy
FollowFollowing
Sign me up
Loading Comments...
Write a Comment...
Xem thêm: Soạn Văn Bài: Đề Văn Thuyết Minh Và Cách Làm Bài Văn Thuyết Minh
Email (Required)Name (Required)Website
Send to e-mail AddressYour NameYour email Address

Post was not sent - check your e-mail addresses!
Email kiểm tra failed, please try again
Sorry, your blog cannot giới thiệu posts by email.
%d bloggers lượt thích this: