
#include<iostream>
using namespace std;
int main() {
int totalCharge;
cin >> totalCharge;
for (int i = 0; i < 9; i++) {
int n;
cin >> n;
totalCharge -= n;
}
cout << totalCharge;
return 0;
}
전체 금액을 입력받고, for문을 통해 9권의 책 가격을 받는 동시에 전체 금액에서 차감하여 나머지 한 책의 가격을 출력하도록 하였다

#include<iostream>
using namespace std;
int main() {
int total;
int A, B;
cin >> A >> B;
while (A != 0 || B != 0) {
cout << A + B << endl;
cin >> A >> B;
}
return 0;
}
0 0이 입력될 때까지 덧셈을 반복하기 위해 while문을 사용하였다