728x90
● [문제번호 10952] A+B - 5
#include <stdio.h>
int main()
{
int A, B;
scanf("%d %d", &A, &B);
while(A != 0 && B != 0)
{
printf("%d\n", A + B);
scanf("%d %d", &A, &B);
}
return 0;
}
● [문제번호 10951] A+B - 4
#include <stdio.h>
int main()
{
int A, B;
while(scanf("%d %d", &A, &B) != EOF)
printf("%d\n", A + B);
return 0;
}
// 커맨드를 이용한 반복문 종료 (연구 필요)
● [문제번호 1110] 더하기 사이클
#include <stdio.h>
int main()
{
int N, count = 0;
scanf("%d", &N);
int temp1 = N;
do
{
count++;
int temp2 = temp1;
if(10 <= temp2)
temp2 = ((temp2 / 10) + (temp2 % 10));
temp1 = ((temp1 % 10) * 10 + (temp2 % 10));
}while(N != temp1);
printf("%d", count);
return 0;
}
728x90
'Baekjoon > 단계별로 풀어보기' 카테고리의 다른 글
[단계08] 기본 수학1 (9문제) (0) | 2020.12.20 |
---|---|
[단계07] 문자열 (10문제) (0) | 2020.12.20 |
[단계06] 함수 (3문제) (0) | 2020.12.18 |
[단계05] 1차원 배열 (7문제) (0) | 2020.12.17 |
[단계03] for문 (11문제) (0) | 2020.12.17 |
[단계02] if문 (5문제) (0) | 2020.12.16 |
[단계01] 입출력과 사칙연산 (11문제) (0) | 2020.12.16 |
댓글