Ad Code

Responsive Advertisement

1021 - Banknotes and Coins

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function



#include <stdio.h>


#include <stdlib.h>





int main()


{


    double n;





    int x, y;





    scanf("%lf", &n);





    x = (int)n;





    y=(n-x)*100;





    printf("NOTAS:\n");





    printf("%d nota(s) de R$ 100.00\n", x/100);





    x%=100;





    printf("%d nota(s) de R$ 50.00\n", x/50);





    x%=50;





    printf("%d nota(s) de R$ 20.00\n", x/20);





    x%=20;





    printf("%d nota(s) de R$ 10.00\n", x/10);





    x%=10;





    printf("%d nota(s) de R$ 5.00\n", x/5);





    x%=5;





    printf("%d nota(s) de R$ 2.00\n", x/2);





    x%=2;





    y=y+(x*100);





    printf("MOEDAS:\n");





    printf("%d moeda(s) de R$ 1.00\n", y/100);





    y%=100;





    printf("%d moeda(s) de R$ 0.50\n", y/50);





    y%=50;





    printf("%d moeda(s) de R$ 0.25\n", y/25);





    y%=25;





    printf("%d moeda(s) de R$ 0.10\n", y/10);





    y%=10;





    printf("%d moeda(s) de R$ 0.05\n", y/5);





    y%=5;





    printf("%d moeda(s) de R$ 0.01\n", y/1);





    return 0;


}





Post a Comment

0 Comments