Advertisement
Norby9

varianta001

Oct 16th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. S1)
  2. 1)d
  3. 2)
  4. )
  5. n = 103456
  6. n z p c
  7. 103456 0 1 6
  8. 10345 3 10 5
  9. 1034 4
  10. 103 3
  11. 10 63 100 0
  12. 963 1000 1
  13. 963
  14.  
  15.  
  16. b) 61 65 67
  17.  
  18. c)
  19.  
  20. citeste n
  21. z<-0
  22. p<-1
  23. executa
  24. c<-n%10
  25. n<-[n/10]
  26. daca c%3=0 atunci
  27. z<-z+p*(9-c)
  28. p<-p*10
  29.  
  30. scrie z
  31.  
  32. d)
  33. #include <iostream>
  34. using namespace std;
  35.  
  36. int main()
  37. {
  38. int n , z , p ;
  39. cin >> n;
  40. z = 0 ; p = 1 ;
  41. while(n)
  42. {
  43. c = n % 10 ;
  44. n /= 10 ;
  45. if(c % 3 == 0)
  46. {
  47. z = z + p *(9-c) ;
  48. p *= 10 ;
  49. }
  50.  
  51. }
  52. cout << z ;
  53. return 0;
  54. }
  55. S2)
  56. 1) 5,3 c
  57. 3)
  58. C.x = (A.x+B.x) / 2 ;
  59. C.y = (A.y+B.y) / 2 ;
  60.  
  61. 5)
  62. #include <iostream>
  63.  
  64. using namespace std;
  65.  
  66. int minim(int a , int b)
  67. {
  68. if(a > b) return b ;
  69. return a ;
  70. }
  71.  
  72. int main()
  73. {
  74. int a[12][12] , n , m , i , j ;
  75. cin >> n >> m ;
  76. for(i = 1 ; i <= n ; ++ i)
  77. {
  78. for(j = 1 ; j <= m ; ++ j )
  79. {
  80. a[i][j] = minim(i , j) ;
  81. cout << a[i][j] << " ";
  82. }
  83. cout << endl ;
  84. }
  85.  
  86. return 0 ;
  87. }
  88.  
  89. S3)
  90. 1)
  91.  
  92. 2)f(121,1) =
  93.  
  94.  
  95. 3)#include <iostream>
  96.  
  97. #include <fstream>
  98.  
  99. using namespace std;
  100.  
  101. ifstream fin("bac.txt") ;
  102.  
  103. int main()
  104. {
  105. int n , x , counter = 0 ;
  106.  
  107. cin >> n ;
  108. while(fin >> x)
  109. {
  110. if(x % n == 0){ cout << x << " "; counter ++ ;}
  111. }
  112. if(counter == 0) cout << "NU EXISTA" ;
  113. }
  114.  
  115. 4)
  116. a)
  117. int sub(int v[] , int n , int a)
  118. {
  119. int cate = 0 ;
  120. for(int i = 1 ; i <= n ; ++ i)
  121. if(v[i] < a) cate ++ ;
  122. return cate ;
  123. }
  124.  
  125. b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement