Monday, June 3, 2019

Write a program to count the individual numbers of the given number


/* ***********************************************
    Write a program to count the individual numbers of the given number

 date:03-06-2019
 created by:ANIL DURGAM

*****************************************************/


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int sum=0,n,rem=0;
    printf("please enter the number\n");
    scanf("%d",&n);

    while(n>0)
    {
        rem=n%10;
        sum+=rem;
        n/=10;
    }
    printf("sum of the digits of the given number is ==%d\n",sum);
    return 0;
}



No comments:

Post a Comment

python class topic video