Write a C program to find the sum of individual digits of a 3 digit number.
Program Code:
#include<stdio.h>
int main()
{
int n,d1,d2,d3;
printf("\n enter the values of 3 digit no:");
scanf("%d",&n);
d1=n%10;
n=n/10;
d2=n%10;
n=n/10;
d3=n%10;
n=n/10;
n=d1+d2+d3;
printf("the sum of individual number=%d",n);
}
Post A Comment:
0 comments: