조회 수 568 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

이전 다음 위로 아래로 댓글로 가기 인쇄 첨부 목록
?

단축키

Prev이전 문서

Next다음 문서

이전 다음 위로 아래로 댓글로 가기 인쇄 첨부 목록
Extra Form
  • profile
    너에게제공 2013.03.19 10:36 글쓴이
    #include <iostream>
    using namespace std;

    class num
    {
    private:
    int number, sum;
    public:
    num(int n)
    { number = n; }

    int calcSum()
    {
    int n=number;
    int k=1;
    while(k-n<0)
    {
    k=k*10;
    }
    int mok;
    int hap=0;
    while(n>0)
    {
    mok=n/k;
    n=n%k;
    k=k/10;
    hap=hap+mok;
    }
    return hap;
    }
    };
    void main()
    {
    num n(1889);
    cout<<n.calcSum()<<endl;
    }

List of Articles
번호 분류 제목
118 JSP 1 file
117 C언어 10월18일 c언어 실습 file
116 CRM 11,12 file
115 JSP 11월1일 JSP 실습 file
114 XML 124 file
113 XML 124 file
112 C언어 3-28 file
111 C언어 5개 선택 정렬(ver.1)
110 6 file
109 8 file
108 JSP 9 file
107 C언어 A
106 ad file
105 C언어 af
104 C언어 Animal 클래스
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8