Bomb Kirby Running
Cat Life - GT-K
2058번 자릿수 더하기

2023. 3. 20. 17:28SWEA

Problem Solving - Level 1 - 자릿수 더하기

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5QPRjqA10DFAUq&categoryId=AV5QPRjqA10DFAUq&categoryType=CODE

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    int N,sum=0;
    cin>>N;
     
    while(N!=0)
    {
        sum+=(N%10);
        N/=10;
    }
     
    cout<<sum;
}

'SWEA' 카테고리의 다른 글

2068번 최대수 구하기  (0) 2023.03.20
2063번 중간값 찾기  (0) 2023.03.20
2056번 연월일 달력  (0) 2023.03.20
2050번 알파벳을 숫자로 변환  (0) 2023.03.20
2047번 신문 헤드라인  (0) 2023.03.20