Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int n,numar,max,min,c,aux_1,aux_2,i,copie;
  6. scanf("%d",&n);
  7. for(i=1;i<=n;i++)
  8. {
  9. c=0;
  10. scanf("%d",&numar);
  11. copie=numar;
  12. while(numar!=0)
  13. {
  14. c=c+numar%10;
  15. numar/=10;
  16. }
  17.  
  18.  
  19. if(c>max)
  20. {
  21. max=c;
  22. aux_1=copie;
  23. }
  24. else if(c<min)
  25. {
  26. min=c;
  27. aux_2=copie;
  28. }
  29.  
  30. }
  31. printf("cel mai mic numar este %d si cel mai mare este %d",aux_2,aux_1);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement