ADS

C Program To Find Sum Of Individual Digits | C Programming

C Program To Find Sum Of Individual Digits


#include<stdio.h>
int main()
{     int a, sum;  
    printf("Enter the digits: "); 
    scanf("%d",&a);  
    for(sum=0;a>0;a=a/10)
          sum = sum + (a%10);
      printf("Sum of digits: %d",sum);
      return 0;  
 } 

Output:-
C program to find sum of individual digits

Post a Comment

0 Comments