刚刚接触C,求助
刚刚开始认识C,为什么每当输入数字时,command window 会自动关闭。我用Dev、C++开始学习的。
谢谢回复
谢谢回复,随心。。。这么快, 出乎意料。我刚学了2天,我会继续坚持。。。
/* change.c */
#include <stdio.h>
int main()
{
int amount, twenties, tens, fives, ones, r20, r10;
printf("Enter the amount of change needed:");
scanf("%d", &amount);
twenties = amount/20; //number of 20s notes
r20 = amount % 20; //number of remainder after 20s
tens = r20/10; //numer of 10s notes
r10 = r20 % 10; //number of remainder after 10s
fives = r10/5; //number of 5s notes
ones = r10 % 5; //number of 1s notes
putchar('\n');a
printf("To make change for $%d give the following:\n", amount);
printf("%d twenties\n", twenties);
printf("%d tens \n", tens);
printf("%d fives \n", fives);
printf("%d ones \n", ones);
return 0;
}