반응형
#include<stdio.h>
int main()
{
	int x=10, y=20, tmp=30;
	
	x++, ++y; //증감 연산자 활용  
	tmp += x + y++;
	
	printf("x: %d, y: %d, tmp: %d \n", x, y, tmp);
	
	return 0;
}
/*
x: 11, y: 22, tmp: 62

--------------------------------
Process exited after 0.0131 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter2 중급 1  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.24
Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
반응형
#include<stdio.h>
int main()
{
	int n1, n2, n3, min;
	
	printf("세 수를 입력하세요? ");
	scanf("%d%d%d", &n1, &n2, &n3);
	
	printf("입력된 값 n1: %d, n2: %d, n3: %d \n", n1, n2, n3);
	min=(n1<n2? n1 : n2); //3항 연산자 활용  
		min = (n1<n3? min : min); 
	printf("세 수 중 가장 작은 값: %d\n", min);
}
/*
세 수를 입력하세요? 57 10 893
입력된 값 n1: 57, n2: 10, n3: 893
세 수 중 가장 작은 값: 10

--------------------------------
Process exited after 9.787 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 중급 3  (2) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.24
Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
반응형
#include<stdio.h>
int main()
{
	int qty, cost, result;
	
	printf("판매수량? ");
	scanf("%d", &qty);
	
	printf("단가? ");
	scanf("%d", &cost);
	
	if(qty*cost > 1000000)
		result = (qty*cost)-(qty*cost*5e-2);
	else 
		result = qty*cost;
		
	printf("판매금액 : %d \n", result);
	
	return 0;
}
/*
판매수량? 50
단가? 15000
판매금액 : 750000

--------------------------------
Process exited after 4.065 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .

판매수량? 100
단가? 15000
판매금액 : 1425000

--------------------------------
Process exited after 6.397 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 중급 3  (2) 2019.08.26
Chapter2 중급 1  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.24
Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
반응형
#include<stdio.h>

#define TRUE 1
#define FALSE 0

int main()
{
	int k = 1;
	int y=0;
	
	printf("TRUE: %d, FALSE: %d \n",TRUE,FALSE);
	printf("true:%d, false: %d \n",k,y);
	k = 2;
	y = 3;
	printf("true:%d, false: %d\n",k,y);
	 
	return 0;		
}
/*
TRUE: 1, FALSE: 0
true:1, false: 0
true:2, false: 3

--------------------------------
Process exited after 0.008973 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter2 중급 1  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.26
Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
반응형
#include<stdio.h>
int main()
{
	float height = 175.1;
	int salary = 3500000;
	
	printf("성명: 홍길동 \n");
	printf("키(신장): %lf\n", height + 0.00006);
	printf("월급: %d", salary);
	
	 return 0; 
}
/*
성명: 홍길동
키(신장): 175.100006
월급: 3500000
--------------------------------
Process exited after 0.01984 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/ 
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 3 초급 2  (0) 2019.08.26
Chapter 3 초급 2  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
Chapter 2 중급 2  (0) 2019.08.24
반응형
#include<stdio.h>
FuncA()
{
	printf("든든한 ");
}
FuncB()
{
	printf(" !!!\n");
} 
int main()
{
	FuncA();
	printf("C");
	printf("프로그래밍"); 
	FuncB();
	
	return 0; 
}
/*
든든한 C프로그래밍 !!!

--------------------------------
Process exited after 0.01091 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 3 초급 2  (0) 2019.08.24
Chapter3 초급 1  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
Chapter 2 중급 2  (0) 2019.08.24
Chapter2 중급 1  (0) 2019.08.24
반응형
#include<stdio.h>
FuncA()
{
	printf("C ");
} 

int main()
{
	printf("든든한");
	FuncA();
	printf("프로그래밍!!!");
	
	return 0; 
}
/*
든든한C 프로그래밍!!!
--------------------------------
Process exited after 0.01029 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter3 초급 1  (0) 2019.08.24
Chapter 2 고급2  (0) 2019.08.24
Chapter 2 중급 2  (0) 2019.08.24
Chapter2 중급 1  (0) 2019.08.24
Chapter2 초급 2  (0) 2019.08.24
반응형
#include<stdio.h>
int main()
{
	printf("   *\n");
	printf("  ***\n");
	printf(" **C**\n");
	printf("  ***\n");
	printf("   *\n");
	
	return 0;
} 
/*
   *
  ***
 **C**
  ***
   *

--------------------------------
Process exited after 0.01302 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 고급2  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
Chapter2 중급 1  (0) 2019.08.24
Chapter2 초급 2  (0) 2019.08.24
Chapter2 초급 1 - 출력하기  (0) 2019.08.24
반응형
#include<stdio.h>
int main()
{
	printf("    *\n   ***\n  *****\n");
	return 0;	
} 
/*
    *
   ***
  *****

--------------------------------
Process exited after 0.01105 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 고급2  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
Chapter 2 중급 2  (0) 2019.08.24
Chapter2 초급 2  (0) 2019.08.24
Chapter2 초급 1 - 출력하기  (0) 2019.08.24
반응형
include<stdio.h>
int main(){
	printf("든든한 \n");
	printf("c 프로그래밍 !!!");
} 
/*
든든한
c 프로그래밍 !!!
--------------------------------
Process exited after 0.01297 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'C, C++ > 든든한 c programming 단계별 workbook' 카테고리의 다른 글

Chapter 2 고급2  (0) 2019.08.24
Chapter2 고급 1  (0) 2019.08.24
Chapter 2 중급 2  (0) 2019.08.24
Chapter2 중급 1  (0) 2019.08.24
Chapter2 초급 1 - 출력하기  (0) 2019.08.24

+ Recent posts