Taek
1. #include int main(void){ int year, month, day; printf("Enter a date (mm/dd/yyyy) : "); scanf("%d/%d/%d",&month,&day,&year); printf("You entered the date %d%.2d%d\n",year,month,day); return 0;} 2. #include int main(void){ int item, year,day,month; float price; printf("Enter item number: "); scanf("%d", &item); printf("Enter unit price : "); scanf("%f", &price); printf("Enter purchase date (mm/..
1. a) " 86,1040" 86을 4칸 띄우고 출력한다. %m.pf에서 m은 출력할 최소너비이고 p는 최소 출력할 문자 개수이다. 최소 너비는 모자르면 빈 칸으로, 최소 문자는 0으로 출력하게 된다. b) " 3.02530e+1"로 출력된다. %m.pe에서 m은 f와 똑같고 p는 소수점 이후에 몇 개가 출력되는지를 의미한다. c) "83.1620"%m.pf에서 m과 p는 e와 같은 의미이다. 단, f는 지수 형식으로 출력되지 않는다. d) "1e-06"%m.pg에서 p는 '수의 크기'에 따라 지수형식이나 고정 소수점수로 표현한다. p에 따라 표시할 개수가 달라진다. 2. a) printf("%-8.1e", x);b) printf("%10.6e", x);c) printf("%-8.3f", x);d) p..
1. #include int main(void){ printf(" *\n"); printf(" *\n"); printf(" *\n"); printf("* *\n"); printf(" * *\n"); printf(" *\n"); return 0;} 2. #include int main(void){ int radius = 10; float volume = ( ( radius * radius * radius * 3.14) * (4.0f / 3.0f) ); printf("Volume of sphere with 10-meter radius is %f\n", volume); return 0; } 3. #include int main(void){ int radius; printf("Enter the radius of..