fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int inc=5;
  6. while(inc>0)
  7. {int x,s=0;
  8. cin>>x;
  9. while(x)
  10. {
  11. int u=x%10;
  12. s=s+u;
  13. x=x/10;
  14. }
  15. if(s==7)
  16. {
  17. cout<<"good"<<" ";
  18. break;
  19. }
  20. else
  21. {
  22. cout<<"wrong"<<" ";
  23.  
  24. }
  25. inc--;
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5320KB
stdin
124345 12 35 52
stdout
wrong wrong wrong good