Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Adding Digits

 Adding Digits Solution:

#include <stdio.h>

int  main()

  {

  int n,d,sum=0;

  scanf("%d",&n);

  while (n > 0)

    {

    d=n%10;

    sum=sum+d;

    n/=10;

    }

  printf("%d",sum);
  
return 0;
}

Post a Comment

0 Comments