我需要分解各自账单/硬币的金额.
输出有点像这样:
到目前为止,这是我的代码:(我在最后几个代码中注释了一个'因为错误来自那里)
{
int x,y;
printf("Enter input: ");
scanf("%d",&x);
y=x/1000;
printf("\n# of $1000 bill: %d",y);
x = x%1000;
y=x/500;
printf("\n# of 4500 bill: %d",y);
x = (x%500);
y=x/200;
printf("\n#. of $200 bill: %d",y);
x = (x%200);
y=x/100;
printf("\n# of $100 bill: %d",y);
x = (x%100);
y=x/50;
printf("\n# of $50 bill: %d",y);
x = (x%50);
y=x/20;
printf("\n# of $20 bill: %d",y);
x = (x%20);
y=x/10;
printf("\n#. of $10 coin: %d",y);
x = (x%10);
y=x/5;
printf("\n#. of $5 coin: %d",y);
x …Run Code Online (Sandbox Code Playgroud) 这是预期的输出:
替代文字http://i48.tinypic.com/f1lfuh.jpg
我们要制作一个计算Fibonacci序列的C程序.我们最多只允许3个变量,我们不允许使用循环.而且我不知道该怎么做以及如何开始.
我希望你们能帮助我.:/