Uploaded by sju01132

새 텍스트 문서

advertisement
/*
#include<stdio.h>
int main(void)
{
int input;
printf("Enter a natural number\n");
scanf("%d", &input);
printf("%d\n", (input%5==0) || (input%6==0));
printf("%d\n", (input % 5 == 0) && (input % 6 == 0));
printf("%d\n", (input % 5 != 0) && (input % 6 != 0));
return 0;
}
*/
/*
#include<stdio.h>
#include<math.h>
double square(double n) {
return(n * n);
}
double add(double a, double b) {
return(a + b);
}
int main()
{
double x1, x2, y1, y2;
double n = 0;
double distance;
printf("Enter the coordinates of point p\n");
scanf("%lf", &x1);
scanf("%lf", &y1);
printf("Enter the coordinates of point q\n");
scanf("%lf",&x2);
scanf("%lf", &y2);
n = add(square(x2 - x1), square(y2 - y1));
distance = sqrt(n);
printf("Distance between the points is %lf\n", distance);
return 0;
}
*/
/**/
/*
#include<stdio.h>
#include<math.h>
int square(int n)
{
return(n * n);
}
int main()
{
int a, b;
int c, d;
printf("Enter a, b\n");
scanf("%d", &a);
scanf("%d", &b);
c = square(a);
d = square(b);
printf("%d*%d+%d*%d=%d\n", a, a, b, b, c + d);
return 0;
}
*/
/*
#include<stdio.h>
char to_upper_case(char ch)
{
return(ch - 32);
}
int main()
{
char ch1,ch2;
printf("알파벳 소문자를 입력하세요\n");
scanf("%c", &ch1);
ch2 = to_upper_case(ch1);
printf("%c", ch2);
return 0;
}
*/
#include<stdio.h>
int main(void)
{
int a;
int b, c, d, e;
printf("Enter the amount of change.\n");
scanf("%d", &a);
b = a / 500;
printf("500원:%d개 ", b);
c = (a - 500 * b) / 100;
printf("100원:%d개 ", c);
d = (a - 500 * b-c* 100)/50;
printf("50원:%d개 ", d);
e = (a - 500 * b - c * 100-d* 50)/10;
printf("10원:%d개\n", e);
return 0;
}
Download