Advertisement
dsdeep

URI 1021 By Loop

Jun 11th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int a[6]={10000,5000,2000,1000,500,200};
  5.     int b[6]={100,50,25,10,5,1};
  6.     double x;
  7.     int n,y;
  8.     scanf("%lf",&x);
  9.     n=x*100;
  10.     printf("NOTAS:\n");
  11.     for(int i=0;i<6;i++)
  12.     {
  13.         y=n/a[i];
  14.         n=n%a[i];
  15.         printf("%d nota(s) de R$ %.2f\n",y,(float)a[i]/100);
  16.     }
  17.     printf("MOEDAS:\n");
  18.     for(int j=0;j<6;j++)
  19.     {
  20.         y=n/b[j];
  21.         n=n%b[j];
  22.         printf("%d nota(s) de R$ %.2f\n",y,(float)b[j]/100);
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement