Skip to main content

URI problem 1021 solution

Here is the solution to URI problem ID: 1021



#include<stdio.h>

int main()
{
    double N,D,E;
    int A,B,C,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;
    scanf("%lf",&N);

    A=(int) N;
    a=A/100;
    b=A%100;
    c=b/50;
    d=b%50;
    e=d/20;
    f=d%20;
    g=f/10;
    h=f%10;
    i=h/5;
    j=h%5;
    k=j/2;
    l=j%2;


    D=N*100;
    C=(int) D;
    m=C%100;
    n=m/50;
    o=m%50;
    p=o/25;
    q=o%25;
    r=q/10;
    s=q%10;
    t=s/5;
    u=s%5;

    printf ("NOTAS:\n");
    printf ("%d nota(s) de R$ 100.00\n",a);
    printf ("%d nota(s) de R$ 50.00\n",c);
    printf ("%d nota(s) de R$ 20.00\n",e);
    printf ("%d nota(s) de R$ 10.00\n",g);
    printf ("%d nota(s) de R$ 5.00\n",i);
    printf ("%d nota(s) de R$ 2.00\n",k);
    printf ("MOEDAS:\n");
    printf ("%d moeda(s) de R$ 1.00\n",l);
    printf ("%d moeda(s) de R$ 0.50\n",n);
    printf ("%d moeda(s) de R$ 0.25\n",p);
    printf ("%d moeda(s) de R$ 0.10\n",r);
    printf ("%d moeda(s) de R$ 0.05\n",t);
    printf ("%d moeda(s) de R$ 0.01\n",u);



    return 0;
}

Comments

Popular posts from this blog

URI problem "1040- Average 3" solution

Here is the solution to URI problem ID: 1040 #include<stdio.h> #include<math.h> int main() {     double media, N1,N2,N3,N4,s,k;     scanf("%lf %lf %lf %lf",&N1,&N2,&N3,&N4);     media=((N1*2/10)+(N2*3/10)+(N3*4/10)+(N4*1/10));     printf("Media: %.1lf\n",media);     if(media>=7)     {         printf("Aluno aprovado.\n");     }     else if(media>=5.0&&media<=6.9)     {         printf("Aluno em exame.\n");         scanf("%lf",&s);         printf("Nota do exame: %.1lf\n",s);         k=(media+s)/2;         if(k>=5)         {       ...

URI problem "1065 - Even Between five Numbers " solution

#include<stdio.h> int main() {     int a,b,c,d,e;     int l,j,k,n,p,totale;     scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);     if(a%2==0)     {         l=1;     }     else     {         l=0;     }     if(b%2==0)     {         j=1;     }     else     {         j=0;     }     if(c%2==0)     {         k=1;     }     else     {         k=0;     }     if(d%2==0)     {         n=1;  ...