Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- static int j,i,a[12];
- static double n;
- double m[13]={100,50,20,10,5,2,1,.5,.25,.1,.05,.01,0};
- scanf("%lf",&n);
- while(j!=1)
- {
- a[i]=(int)(n/m[i]);
- n=n-a[i]*m[i];
- i++;
- if(i==12){
- a[i]=n;
- break;
- }
- }
- for(j=0;j!=12;j++){
- if(j==6){
- printf("MOEDAS: \n");
- }
- if(j==0){
- printf("NOTAS: \n");
- }
- if(j<6){
- printf("%d nota(s) de R$ %.2lf\n",a[j],m[j]);
- }
- else{
- printf("%d moeda(s) de R$ %.2lf\n",a[j],m[j]);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement