Guest User

fdsfdsfds

a guest
Sep 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5. int Suma_cif (unsigned long x)
  6. {
  7.  
  8. int S= 0;
  9. while(x){
  10. S+=x%10;
  11. x/=10;}
  12. return S;}
  13. int Cif_control (unsigned long x)
  14. {
  15. while(x>9)
  16. x=Suma_cif(x);
  17. return x;
  18. }
  19. int Prim(int x)
  20. {
  21. if (x<2)
  22. return 0;
  23. for(int i=2; i<= sqrt(x);i++)
  24. if(x%i == 0)
  25. return 0;
  26. return 1;
  27. }
  28. int Nr_Cifre_pare(long N)
  29. {
  30. int nr=0,uc;
  31. while(N!=0){
  32. uc=N%10;
  33. if(uc%2==0)
  34. nr++;
  35. N/=10;
  36.  
  37. }
  38. return nr;
  39. }
  40. int Triunghi(float a, float b,float c)
  41. {
  42.  
  43. if((a+b)>c) & ((a+c)>b) & ((b+c)>a)
  44. return 1;
  45. else
  46. return 0;
  47. int main()
  48. }
  49. int Palindrom(int n)
  50. {
  51. int inv=0,cn=n;
  52. while(n!=0)
  53. inv =inv*10 + n%10;
  54. n/=10;
  55.  
  56. }
  57.  
  58.  
  59.  
  60.  
  61. {
  62.  
  63. /* int N,p,x;#include <iostream>
  64. #include <math.h>
  65.  
  66. using namespace std;
  67. int Suma_cif (unsigned long x)
  68. {
  69.  
  70. int S= 0;
  71. while(x){
  72. S+=x%10;
  73. x/=10;}
  74. return S;}
  75. int Cif_control (unsigned long x)
  76. {
  77. while(x>9)
  78. x=Suma_cif(x);
  79. return x;
  80. }
  81. int Prim(int x)
  82. {
  83. if (x<2)
  84. return 0;
  85. for(int i=2; i<= sqrt(x);i++)
  86. if(x%i == 0)
  87. return 0;
  88. return 1;
  89. }
  90. int Nr_Cifre_pare(long N)
  91. {
  92. int nr=0,uc;
  93. while(N!=0){
  94. uc=N%10;
  95. if(uc%2==0)
  96. nr++;
  97. N/=10;
  98.  
  99. }
  100. return nr;
  101. }
  102. int main()
  103.  
  104. {
  105. /* int N,p,x;
  106. cin >>N;
  107. cout <<endl <<"Cerinta A: ";
  108. for (int i=2;i<=N;i++)
  109. if(Prim(i) ==1)
  110. cout << i << " ";
  111. cout <<endl <<"Cerinta B: ";
  112. int gasite=0,i=2;
  113. while(gasite < N){
  114. if (Prim(i))
  115. gasite++;
  116. i++;
  117. cout << i << " ";
  118. }
  119.  
  120. int N;
  121. cin >> N;
  122. cout << Nr_Cifre_pare(N);
  123.  
  124.  
  125. return 0;
  126. }
  127.  
  128. cin >>N;
  129. cout <<endl <<"Cerinta A: ";
  130. for (int i=2;i<=N;i++)
  131. if(Prim(i) ==1)
  132. cout << i << " ";
  133. cout <<endl <<"Cerinta B: ";
  134. int gasite=0,i=2;
  135. while(gasite < N){
  136. if (Prim(i))
  137. gasite++;
  138. i++;
  139. cout << i << " ";
  140. }
  141.  
  142. int N;
  143. cin >> N;
  144. cout << Nr_Cifre_pare(N);
  145. */
  146. int main
  147. return 0;
  148. }
Add Comment
Please, Sign In to add comment