Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. cin >> n;
  9. char с;
  10. int b[9];
  11. for (int i =0;i<10;i++)
  12. b[i]=0;
  13. for (int i =0;i<n;i++)
  14. {
  15. cin >> с;
  16. if (с=='0')
  17. b[0]++;
  18. else if (с=='1')
  19. b[1]++;
  20. else if (с=='2')
  21. b[2]++;
  22. else if (с=='3')
  23. b[3]++;
  24. else if (с=='4')
  25. b[4]++;
  26. else if (с=='5')
  27. b[5]++;
  28. else if (с=='6')
  29. b[6]++;
  30. else if (с=='7')
  31. b[7]++;
  32. else if (с=='8')
  33. b[8]++;
  34. else if (с=='9')
  35. b[9]++;
  36. }
  37. for (int i =0;i<10;i++)
  38. cout << b[i] << " ";
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement