uri online judge problem 1021 solution c programming

UIR online judge problem 1021 solution c          
 programming


code : 

#include<stdio.h>
int main()
{
    double nu,bb;

    int N,x1,x2,x3,x4,x5,x6,x7;
    int pois,y1,y2,y3,y4,y5;
    scanf("%lf",&nu);
    N=(int)nu;

   x1=N/100;
        N=N%100;
        x2=N/50;
        N=N%50;
        x3=N/20;
        N=N%20;
        x4=N/10;
        N=N%10;
        x5=N/5;
        N=N%5;
         x6=N/2;
        N=N%2;
         x7=N/1;
        N=N%1;

          bb=nu*100;
          pois=(int)bb%100;

        y1=pois/50;
        pois=pois%50;
        y2=pois/25;
        pois=pois%25;
        y3=pois/10;
        pois=pois%10;
        y4=pois/05;
        pois=pois%05;
        y5=pois/01;
        pois=pois%01;



            printf("NOTAS:\n");
            printf("%d nota(s) de R$ 100.00\n",x1);
            printf("%d nota(s) de R$ 50.00\n",x2);
            printf("%d nota(s) de R$ 20.00\n",x3);
            printf("%d nota(s) de R$ 10.00\n",x4);
            printf("%d nota(s) de R$ 5.00\n",x5);
            printf("%d nota(s) de R$ 2.00\n",x6);



            printf("MOEDAS:\n");
            printf("%d moeda(s) de R$ 1.00\n",x7);
            printf("%d moeda(s) de R$ 0.50\n",y1);
            printf("%d moeda(s) de R$ 0.25\n",y2);
            printf("%d moeda(s) de R$ 0.10\n",y3);
            printf("%d moeda(s) de R$ 0.05\n",y4);
            printf("%d moeda(s) de R$ 0.01\n",y5);



    return 0;
}


output : 




No comments

Powered by Blogger.