Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- S1)
- 1)d
- 2)
- )
- n = 103456
- n z p c
- 103456 0 1 6
- 10345 3 10 5
- 1034 4
- 103 3
- 10 63 100 0
- 963 1000 1
- 963
- b) 61 65 67
- c)
- citeste n
- z<-0
- p<-1
- executa
- c<-n%10
- n<-[n/10]
- daca c%3=0 atunci
- z<-z+p*(9-c)
- p<-p*10
- scrie z
- d)
- #include <iostream>
- using namespace std;
- int main()
- {
- int n , z , p ;
- cin >> n;
- z = 0 ; p = 1 ;
- while(n)
- {
- c = n % 10 ;
- n /= 10 ;
- if(c % 3 == 0)
- {
- z = z + p *(9-c) ;
- p *= 10 ;
- }
- }
- cout << z ;
- return 0;
- }
- S2)
- 1) 5,3 c
- 3)
- C.x = (A.x+B.x) / 2 ;
- C.y = (A.y+B.y) / 2 ;
- 5)
- #include <iostream>
- using namespace std;
- int minim(int a , int b)
- {
- if(a > b) return b ;
- return a ;
- }
- int main()
- {
- int a[12][12] , n , m , i , j ;
- cin >> n >> m ;
- for(i = 1 ; i <= n ; ++ i)
- {
- for(j = 1 ; j <= m ; ++ j )
- {
- a[i][j] = minim(i , j) ;
- cout << a[i][j] << " ";
- }
- cout << endl ;
- }
- return 0 ;
- }
- S3)
- 1)
- 2)f(121,1) =
- 3)#include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.txt") ;
- int main()
- {
- int n , x , counter = 0 ;
- cin >> n ;
- while(fin >> x)
- {
- if(x % n == 0){ cout << x << " "; counter ++ ;}
- }
- if(counter == 0) cout << "NU EXISTA" ;
- }
- 4)
- a)
- int sub(int v[] , int n , int a)
- {
- int cate = 0 ;
- for(int i = 1 ; i <= n ; ++ i)
- if(v[i] < a) cate ++ ;
- return cate ;
- }
- b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement