Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {int n,i,s,max1=0,min1=100,x,y,nmax,nmin;
- scanf("%d",&n);
- for(i=1;i<=n;i++){
- scanf("%d",&x);
- s=0;
- y=x;
- while(x!=0){
- s=s+x%10;
- x=x/10;}
- if(s>max1){
- max1=s;
- nmax=y;
- }
- else
- if(s<min1){
- min1=s;
- nmin=y;
- }
- }
- printf("Numere cu cifra max este=%d \n Numere cu cifra minima=%d",nmax,nmin);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment