100 Most Important C# Programs
8. Program to accept a three digit number and print the sum of individual digits.
Code:
# include <stdio.h>
# include <conio.h>
main( )
{
int a,b,c,n, sum;
clrscr( );
printf (“ Enter a Three Digit Number:“);
scanf (“%d”,&n);
a=n/100;
b=( (n%100)/10);
c=n%10;
sum=a+b+c;
printf (“ Sum of Individual Digits of
Given Numbers is %d”, Sum);
getch( );
}