Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. int nr_seriale, cod_serial, k = 0, i, j, stare;
  6. long long int x = 0, putere = 1, aux;
  7. float rap, ep_vazute, ep_total;
  8. scanf("%d", &nr_seriale);
  9. for (i = 1; i <= nr_seriale; i++)
  10. {
  11. scanf("%d%f%f", &cod_serial, &ep_vazute, &ep_total);
  12. while (cod_serial != 0)
  13. {
  14. putere=12 * putere;
  15. cod_serial--;
  16. }
  17. rap = round((ep_vazute / ep_total) * 10);
  18. // rap = (ep_vazute / ep_total) * 10;
  19. // if ((int)((rap * 10)) % 10 >= 5) stare=(int)(rap) + 1;
  20. // else
  21. stare=(int)(rap);
  22. printf("%d%f\n", stare, rap);
  23. x = x + putere*(stare +1 );
  24. putere = 1;
  25. }
  26. aux = x;
  27. for (j = 10; j>=0; j--)
  28. {
  29. aux = x;
  30. for (i = 1; i <= nr_seriale; i++)
  31. {
  32. int k = 0;
  33. if (j == 0) {
  34. while (aux != 0) {
  35. if(aux % 12 != 0)
  36. printf("%d ", k);
  37. aux = aux / 12;
  38. k++;
  39. }
  40. }
  41. while(aux != 0) {
  42. if (aux % 12 != 0) {
  43. if (aux % 12 >= j + 1)
  44. printf("* ");
  45. else
  46. printf(". ");
  47. }
  48. aux = aux / 12;
  49. }
  50. }
  51. printf ("\n");
  52. }
  53.  
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement