Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int input=0,dig=0, n_dig=0, min=0, max=0, suma=0, temp;
- printf ("Ingrese un número entero: \n");
- scanf("%d", &input);
- temp=input;
- do{
- dig=temp%10;
- n_dig++;
- suma+=dig;
- if (n_dig==1){
- min=dig;
- max=dig;
- }
- else {
- if (dig<min){
- min=dig;
- }
- if (dig>max){
- max=dig;
- }
- }
- temp/=10;
- }while(temp>0);
- printf ("El numero %d posee las siguientes características: \n Posee %d dígitos.\n La suma de sus dígitos es %d\n El dígito menor es %d\n El dígito mayor es %d.\n", input, n_dig, suma, min, max);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement