DarthVictor

Untitled

Sep 20th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. using namespace std;
  4. int verifica_menor_numero_notas(int v);
  5. //Entendi, que é o menor número de células possíveis, não vejo necessidade de mostrar o valor de cada célula
  6. //Mas me avise, caso o programa não for o que você deseja.
  7. int main()
  8. {
  9. int val;
  10. cout<<"entre com o valor  ";
  11. cin>>val;
  12. cout<<"menor numero : "<<verifica_menor_numero_notas(val);
  13. cout<<"\n";
  14.  
  15. return 0;
  16. }
  17.  
  18. int verifica_menor_numero_notas(int v)
  19. {
  20. int n;
  21.   while(v >= 100){v=v-100;n++;}
  22.   while(v >= 50){v=v-50;n++;}
  23.   while(v >= 20){v=v-20;n++;}
  24.   while(v >= 10){v=v-10;n++;}
  25.   while(v >= 5){v=v-5;n++;}
  26.   while(v >= 2){v=v-2;n++;}
  27.   while(v >= 1){v=v-1;n++;}
  28. return n;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment