#include <stdio.h>
#include <stdbool.h>
void printIntList(int *ansList, int endIdx) {
for (int i = 0; i < endIdx; i++) {
if (ansList[i] % 2) {
printf("%d ", ansList[i] + 3);
} else{
printf("%d ", ansList[i] / 2);
}
}
}
int main() {
int intList[100];
int idx = 0;
int currInt;
while (true) {
scanf("%d ", &currInt);
if (currInt == 0) {
printIntList(intList, idx);
break;
}
intList[idx] = currInt;
idx++;
}
return 0;
}
'Algorithm(CodeTree, C++) > 1차원 배열' 카테고리의 다른 글
[코드트리] 전항의 두 배 C (1) | 2024.05.15 |
---|---|
[코드트리] 100 도달하기 C (0) | 2024.05.15 |
[코드트리] 숫자들의 배수 C (0) | 2024.05.13 |
[코드트리] 짝수인 것만 출력하기 C (0) | 2024.05.13 |
[코드트리] 일의 자리 배열 C (0) | 2024.05.13 |