Advertisement
FazEN

Untitled

Mar 16th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. void x(int *a)
  6. {
  7.  
  8. int i1=0;
  9. int f1=*a;
  10. int s1=0;
  11. int c1=0;
  12. int a3=*a;
  13. int f=*a;
  14. while (*a!=0) {
  15.  
  16. ++i1;
  17. c1=*a%10;
  18. *a/=10;
  19.  
  20. }
  21.  
  22.  
  23. do {
  24. int k=pow(10,i1);
  25. s1+=f1/k;
  26. f1%=k;
  27.  
  28. --i1;
  29. } while (i1!=0);
  30. int a2=s1+f%10;
  31. int a1=a2/10+a2%10;
  32. *a=a3+a2+a1;
  33.  
  34.  
  35. }
  36.  
  37. int main() {
  38.  
  39. int *a=0;
  40. cin>>*a;
  41. if (x(*a)==3) { // именно здесь мне нужно проверить, если в конце всех вычислений, a будет равно 3, то я сделаем то-то то-то
  42.  
  43. }
  44.  
  45. return 0;
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement