문제를 풀어봤는데 점점 어려워지네요 ..


(C린이) #1
  1. Write a program that converts time in minutes to time in hours and minutes. Use

#define or const to create a symbolic constant for 60. Use a while loop to allow the

user to enter values repeatedly and terminate the loop if a value for the time of 0 or less

is entered.

2.Write a program that asks for an integer and then prints all the integers from (and

including) that value up to (and including) a value larger by 10. (That is, if the input is 5,

the output runs from 5 to 15.) Be sure to separate each output value by a space or tab or

newline.

=> 저는 이걸 아무리 생각해도 떠오르지않아서 변수2개를 잡고 한번더 입력받아서 while문을 작성했는데

이게 아닌 것 같은데 number

  1. Write a program that asks the user to enter a height in centimeters and then displays the

height in centimeters and in feet and inches. Fractional centimeters and inches should

be allowed, and the program should allow the user to continue entering heights until a

nonpositive value is entered. A sample run should look like this:

Enter a height in centimeters: 182

182.0 cm = 5 feet, 11.7 inches

Enter a height in centimeters (<=0 to quit): 168.7

168.0 cm = 5 feet, 6.4

inches

Enter a height in centimeters (<=0 to quit): 0

bye

  1. Change the program addemup.c ( Listing 5.13 ), which found the sum of the first 20

integers. (If you prefer, you can think of addemup.c as a program that calculates how

much money you get in 20 days if you receive $1 the first day, $2 the second day, $3 the

third day, and so on.) Modify the program so that you can tell it interactively how far

the calculation should proceed. That is, replace the 20 with a variable that is read in.

#include <stdio.h>
 
int main(void) {
 int count = 0, sum = 0, day;
 printf("언제까지 일을 하셨습니까?n");
 scanf("%d", &day);
 while(count++ < day )
 {
 sum = sum + count; 
 }
 return 0;
}
  1. Now modify the program of Programming Exercise 5 so that it computes the sum of the

squares of the integers. (If you prefer, how much money you receive if you get $1 the

first day, $4 the second day, $9 the third day, and so on. This looks like a much better

deal!) C doesn’t have a squaring function, but you can use the fact that the square of n is

n * n .

#include 
 
int main(void) {
 int count = 0, sum = 0, day, pay;
 printf("일한 날짜를 입력해주세요.n");
 scanf("%d", &day);
 while (count++ < day)
 {
  sum = sum + pay * pay;
  pay++;
 }
 return 0;
}

제가 군인인데 사지방에서 공부하다보니 인터넷 쓸 시간도 많이없고, 영어 실력이 많이 부족해
프로그래밍갤러리와 여기에 글을 자꾸 올리게 되는데 매번 감사하며 죄송하다는 말씀 드립니다 __)
특히 매번 답글 달아주시는 코세형님 감사합니다. 올려주신 덧글은 매번 잘 보고 있습니다.


(바보털) #2

요즘에는 한글 자료도 많은데 왜 굳이 영어 문제를요…?


(Hyun) #3

2번 문제같은 경우는 단순히 입력숫자를 포함 11개의 숫자를 찍어내라는 말이네요. 그냥 for문을 11번 돌려도 되는 부분입니다. 물론 출력부는 자기 하기 마음이고요.