Presentation is loading. Please wait.

Presentation is loading. Please wait.

Homework 1 (due:April 13th) Deadline : April 13th 11:59pm Where to submit? eClass 과제방 (http://eclass.cau.ac.kr) How to submit? Create a folder. The name.

Similar presentations


Presentation on theme: "Homework 1 (due:April 13th) Deadline : April 13th 11:59pm Where to submit? eClass 과제방 (http://eclass.cau.ac.kr) How to submit? Create a folder. The name."— Presentation transcript:

1 Homework 1 (due:April 13th) Deadline : April 13th 11:59pm Where to submit? eClass 과제방 (http://eclass.cau.ac.kr) How to submit? Create a folder. The name of the folder should be “studentID#.hw1”. (ex) 20111499.hw1 We have three problems in hw1. Make three C source files. The name of the source files should be the format “studentID#.hw1.#.c” (ex) 20111499.hw1.1.c, 20111499.hw1.2.c, 20111499.hw1.3.c In each source file.c, your code must have comments that include your name and student_id# Put the three source files into the folder we created. Compress the folder into a zip file. The name of the zip file should be “student#.hw1.zip”. (ex) 20111499.hw1.zip Upload the zip file into eClass website. If you don’t follow above instructions, you may get penalty in your score. You must do programming yourself.

2 1. Write a program that reads an arbitrary positive integer (<1,000,000,000) and prints the sum of its digits as an output. (Use while or for loop to handle arbitrary number) #include int main() { int num; scanf(“%d”,&num); // put your code here return 0; } 421376689 Input example 46 output example

3 2. Write a C program that output as follows. You must use for-loop appropriately. Output : * *** ***** ******* ********* ******* ***** *** * #include int main() { ; for ( ) { for ( ) ______________; ; } for ( ) { for ( ) ; ; } return 0; }

4 3. Write a program that gets a starting principal(A, 원금 ), annual interest rate(r, 연 이율 ) from a keyboard (standard input) and print the total amount on deposit ( 예치기간이 지난 뒤 총금액, 원리합계 ) for the year(n) from 0 to 10. total deposit = A*(1+r)^n For example, 1000.0 0.05 <- keyboard input // 5% should be written as 0.05 0 1000.00 1 1050.00 2 1102.50 3 1157.62 4 1215.51 5 1276.28 6 1340.10 7 1407.10 8 1477.46 9 1551.33 10 1628.89

5 4. Write a program that reads an arbitrary positive integer n(<1000) as a keyboard input and prints the sum 1+3+5+…+2*n+1 #include int main() { int n; scanf(“%d”,&n); // put your code here return 0; } 3 Input example 16 output example


Download ppt "Homework 1 (due:April 13th) Deadline : April 13th 11:59pm Where to submit? eClass 과제방 (http://eclass.cau.ac.kr) How to submit? Create a folder. The name."

Similar presentations


Ads by Google