55. WAP to print digits of given integer, sum of each digit of given integer and count of each digit of given integer.

 

#include<stdio.h>

void main()

{

  printf("WAP to print digits of given integer, sum of each digit of given integer and count of each digit of given integer.\n");

        int r,number,c=0,add=0;

        printf("Enter the number :");

        scanf("%d",&number);

        printf("%d\n",number);

        for(;number;number=number/10)

        {

                r = number%10;

                add = add + r;

                c++;

        }

        printf("Addition of number : %d\n",add);

        printf("Total count of digits : %d\n",c);

}

Comments