Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

문타쿠, 공부하다.

[C언어 코딩 도장] Unit 28. 연습문제 및 심사문제 본문

C언어/C언어 코딩 도장

[C언어 코딩 도장] Unit 28. 연습문제 및 심사문제

개발새발 문타쿠 2023. 8. 29. 22:30

28.10 연습문제: while 반복문 사용하기

#include <stdio.h>

int main(void)
{
	unsigned char i = 1;

	while (i != 0)
	{
		printf("%u\n", i);
		i <<= 1;
	}
	
	return 0;
}

28.11 심사문제: 교통카드 잔액 출력하기

#include <stdio.h>

int main(void)
{
	int charge;

	scanf_s("%d", &charge);

	while (charge >= 1200)
	{
		charge = charge - 1200;
		printf("%d\n", charge);
	}
	
	return 0;
}