#include <conio.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main ()
{
int num,sum,a,b,c,d,e,d1,d2,d3,d4,d5;
printf(" Program to calculate the sum of digits of a five digit number \n\n");
printf(" Enter the Five Digits Number \n");
scanf("%d",&num);
a=num/10;
d5=num%10;
b=a/10;
d4=a%10;
c=b/10;
d3=b%10;
d=c/10;
d2=c%10;
e=d/10;
d1=d%10;
sum=d1+d2+d3+d4+d5;
printf("\n Sum of digits of given number is %d",sum);
return 0;
}
No comments:
Post a Comment
Must drop your comments about post.