행복한 프로그래밍 (37) 썸네일형 리스트형 value algorithm #include <stdio.h> main(){ int value1; int value2; int quotient; int remainder; printf("첫 번째 정수: "); scanf("%d", &value1); printf("두 번째 정수: "); scanf("%d", &value2); quotient = value1 / value2; remainder = value1%value2; printf("\n몫은 %d입니다. \n", quotient); printf("나머지는 %d입니다. \n", remainder); return 0; } signal #include <ctype.h> double atof(char s[]) { double val, power; int i, sign; for(i=0, isspace(s[i]); i++) ; sign = (s[i] == '-') ? -1 : 1; if (s[i] == '+' || s[i] == '-') i++; for (val = 0.0; isdigit(s[i]); i++) val = 10.0 * val + (s[i] - '0'); if (s[i] == '.') i++; for ( power = 1.0; isdigit(s[i]; i++)) { val = 10.0 * val + (s[i] - '0'); power *= 10.0; } return sign*val /.. obvious #include <stdio.h> main() { int n, i; double r, result; printf("실수의 값을 입력하시오: "); scanf("%lf", &r); printf("거듭제곱횟수를 입력하시오: "); scanf("%d", &n); result = 1.0; for(i = 0; i < n; i++) result *= r; printf("결과값은 %f", result); return 0; } 질문에 답하기 #include <stdio.h> main() { char location[100]; int date; float temp; printf("어디에 살고 계시나요? "); scanf("%s", location); printf("오늘이 며칠인가요?"); scanf("%d", &date); printf("오늘 기온은 몇도인가요?(실수로) "); scanf("%f", &temp); printf("\n오늘은 %d일이고 %s이라는 아주 좋은 곳에 살고 계시군요!\n", date, locati.. 히카루의 논리 #include <stdio.h> #include <string.h> #define MAXLINE 1000 int getline(char *line, int max); main(int argc, char *argv[]) { char line[MAXLINE]; long lineno = 0; int c, except = 0, number = 0, found = 0; while(--argc > 0 && (*++argv)[0] == '-') while(c = *++argc[0]} switch (c) { case 'x' : except = 1; break; case 'n' : number = 1; break; default: printf("find: i.. 배열의 기본 #include <stdio.h> main() { int gameScores[10] = { 12, 5, 21, 15, 32, 10}; int totalPoints = 0; int i; float avg; for(i = 6; i < 10; i++) { printf("게임 %d에서 선수의 득점은? ", i + 1); scanf(" %d", &gameScores[i]); } for(i = 0; i<10; i++) { totalPoints += gameScores[i]; } avg = ((float)totalPoints / 10); printf("\n\n선수의 평균 득점은 %.1f.\n", a.. movie #include <stdio.h> #include <string.h> main() { int ctr, numMovies, rating, favRating, leastRating; char movieName[40], favorite[40], least[40]; favRating = 0; leastRating = 10; do{ printf("금년에 영화를 몇 편이나 보았습니까? "); scanf(" %d", &numMovies); if(numMovies < 1) { printf("영화수가 0입니다. \n다시 입력하시오!\n\n"); } } whi.. initial #include <stdio.h> main() { char firstInitial; char lastInitial; int age; int favorite_numberl printf("이름(영어로)은 무슨 글자로 시작합니까? \n"); scanf(" %c", &firstInitial); printf("성(영어로)은 무슨 글자로 시작합니까? \n"); scanf(" %c", &lastInitial); printf("나이는 몇 살인가요?? \n"); sacnf(" %d", &age); printf("제일 좋아.. 이전 1 2 3 4 5 다음