Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

새싹교실/2016/리바이반/0413

From ZeroWiki
Revision as of 12:03, 13 April 2016 by imported>김남효

참여자 명단

반장 장용운 11학번 출석
조사병 김남효 16학번 출석
이길상 출석

수업

진행

  1. 장소 : 6층 학회실
  2. 시간 : 18시 ~ 20시

내용

4강. 그림을 그리듯이 프로그래밍한다

  • 본격 조건 연산자 해부
  • if ~ else 와 else if
  • 삼항 연산자
  • switch
○ switch~case
  • while 과 do while
  • break와 continue
  • for 맛보기

실습

  • if ~ else if ~ else 갖고놀기
  • switch 익히기
  • while로 고통받기
○ Factorial 연산 구현하기
○ 구구단 출력하기
○ 유클리드 호제법


코드

예제1

  1. include <stdio.h>
  2. pragma warning(disable:4996)

int main() { int a,b=1,c=0; char d; while(1){ printf("Hello!\n"); printf("1) 사칙연산\n"); printf("2) 팩토리얼\n"); printf("3) 세제곱\n"); scanf("%d",&a);

if(a == 1) { while(1){ scanf("%d",&b); if(b==-1) { break; } else { scanf("%c %d",&d,&c); switch(d){ case '+': printf("%d\n",b+c); break; case '-': printf("%d\n",b-c); break; case '/': printf("%d\n",b/c); break; default: printf("%d\n",b*c); break; } } } } else if(a==2) { while(1) {

scanf("%d",&c); if(c==-1) { break;

} else { while(c>=1) { b *= c; c--; } printf("%d\n",b); b = 1; } } } else { while(1){ scanf("%d",&b); if(b==-1) { break;

} else { c = b*b*b; printf("%d\n",c); } } } } return 0; }

  1. include <stdio.h>
  2. pragma warning(disable:4996)

int main() { float i = 10; float b; while(i>-11) { if(i==0){ i--; continue; } else { b = 10/i; printf("%f\n",b); i--; } } return 0; }

  1. include <stdio.h>
  2. pragma warning(disable:4996)

int main() { int a,b,c; scanf("%d %d",&a,&b); while(1) { if(a%b==0){ printf("%d\n",b); break; } if(a>=b) { c = b; b = a % b; a = c; } else { c = b; b = a; a = c; continue; }


} return 0; }

숙제

  1. 이 페이지에 후기 작성하기!
  2. 오늘 공부한 개념 수업 페이지에 정리하기!
  3. 시험 잘보기

후기

  • 후기 작성 요령 : 후기는 F4(ThreeFs + Future Action Plan)에 맞게 작성해주세요.
    • Facts, Feelings, Findings, Future Action Plan. 즉, 사실, 느낀 점, 깨달은 점, 앞으로의 계획.
*
*
*


숙제 제출

김남효

이길상



새싹교실/2016 새싹교실/2016/리바이반