fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int a[20],n,i,j,k[10],count[10];
  7. cout<<"enter the no of sales";
  8. cin>>n;
  9. for(int i=0;i<n;i++)
  10. {
  11. cin>>a[i];
  12. }
  13. int o;
  14.  
  15. for(j=0;j<n;j++)
  16. {
  17. for(i=0;i<4;i++)
  18. {
  19.  
  20.  
  21. o=a[j]%10;
  22. a[j]=a[j]/10
  23. count[o]++;
  24. }
  25. }
  26.  
  27.  
  28.  
  29. for(o=0;o<10;o++)
  30. {
  31. cout<<"\n count of "<<o<<" = "<<count[o];
  32. }
  33.  
  34.  
  35.  
  36. for(i=0;i<10;i++)
  37. {
  38. k[i]=i;
  39. }
  40.  
  41.  
  42. for(i=0;i<10;i++)
  43. {
  44. for(j=0;j<10-i;j++)
  45. {
  46.  
  47. if(count[i]<count[i+1])
  48. {
  49. int temp;
  50. temp=k[i+1];
  51. k[i]=k[i+1];
  52. k[i+1]=temp;
  53.  
  54. temp=count[i+1];
  55. count[i]=count[i+1];
  56. count[i+1]=count[i];
  57. }
  58.  
  59.  
  60.  
  61. }
  62.  
  63. }
  64. for(i=0;i<10;i++)
  65. {
  66. if(k[i]==7)
  67. {
  68. cout<<endl<<endl<<i+1;
  69. }
  70.  
  71. }
  72.  
  73.  
  74.  
  75. return 0;
  76. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
4
3517
3367
3766
3333
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:23:2: error: expected ‘;’ before ‘count’
  count[o]++;
  ^~~~~
stdout
Standard output is empty