Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
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
Tags
more
Archives
Today
Total
관리 메뉴

이것저것

C언어 swea 1926 간단한 369게임 본문

Language/C언어

C언어 swea 1926 간단한 369게임

olivia-com 2020. 11. 19. 22:16

https://swexpertacademy.com/main/identity/anonymous/loginPage.do

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

#include <stdio.h>
#include <stdbool.h>


int main(void){
	int num,i;
	scanf("%d", &num);
	
	for(i = 1; i<= num; i++){
		bool check = false;
		int n = i;
		while(n){
			if((n % 10 == 3) || (n % 10 == 6) || (n % 10 == 9)){ 
			// 각 숫자 자리에 3,6,9가 있는지 확인 
				check = true; //있으면 true 로 - 출력 
				printf("- ");
			}
			n /= 10;
		}
		if(check == false){ //없으면 숫자 그대로 출력 
			printf("%d ", i);
		}
	}
	
	return 0;
} 

'Language > C언어' 카테고리의 다른 글

C언어 swea 1966 숫자를 정렬하자  (0) 2020.11.19
C언어 swea 1976 시각 덧셈  (0) 2020.11.19
C언어 swea 1284 수도 요즘 전쟁  (0) 2020.11.19
이진 체계 정리  (0) 2020.11.19
C언어 swea 1986 지그재그 숫자  (0) 2020.11.19