Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I.
- 1.b
- 2.b
- 3.a
- 4.d
- 5.c
- II.
- 1.
- a) -1
- b) 7888 , 7889 ,7999
- c)
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {int n,m,c;
- cin>>n;
- m=10;
- if(n==0)
- m=0;
- else
- {do{c=n%10;
- n=n/10;
- if(c<=m)
- m=c;
- else
- m=-1;
- }while(n!=0);
- }
- cout<<m;
- return 0;
- }
- d)
- citește n (număr natural)
- m10
- ┌dacă n=0 atunci
- │ m<-0
- │altfel
- │ c<-n%10; n<-[n/10]
- │ ┌dacă c<=m atunci mc
- │ │altfel m<- -1
- │ └■
- │ ┌cat timp n!=0
- | | c<-n%10; n<-[n/10]
- │ |┌dacă c<=m atunci mc
- │ |│altfel m<- -1
- │ |└■
- │ └■
- └■
- scrie m
- 2.
- 149
- 167
- 347
- 3.
- 7
- 2020-2021
- III.
- 1.
- void divX(int n,int x)
- {int c,i;
- c=n*x;
- for(i=n;i>=1;i--)
- {cout<<c<<" ";
- c=c-x;}
- }
- 2.
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {int a[101][101],i,j,n;
- cin>>n;
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- cin>>a[i][j];
- for(i=1;i<=n;i++)
- cout<<a[i][1]<<" ";
- for(j=2;j<=n;j++)
- cout<<a[n][j]<<" ";
- for(i=n-1;i>=1;i--)
- cout<<a[i][n]<<" ";
- for(j=n-1;j>=2;j--)
- cout<<a[1][j]<<" ";
- return 0;
- }
- 3.
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("bac.in");
- int ap[101];
- int main()
- {int x,ok=0,cate=0,i;
- while(fin>>x)
- {if(log10(x)+1==2)
- if(ap[x]==0)
- {cate++;
- ap[x]=1;}}
- if(cate>79)
- cout<<"nu exista";
- else
- for(i=99;i>=10;i--)
- {if(ap[i]==0 && i%11!=0)
- {cout<<i<<" ";
- ok++;}
- if(ok==2)
- break;}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement