Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- a.-1
- b.7777
- 7778
- 7779
- c.
- #include <iostream>
- 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.
- citeste->n
- m<-10
- { daca n=0 atunci
- m<-0
- altfel
- { cat timp n!=0 executa
- c<-n%10
- n<-n/10
- { daca c<=m atunci
- m<-c
- altfel
- m<- -1
- }
- }
- }
- scrie m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement