write a program to calculate sum of individual digits of a given number.
#include<stdio.h>
#include<conio.h>
void main()
{
int num, sum=0, rem:
clrscr():
printf("input the number"):
scanf("%d", $num):
for (:num>0: num/10)
{
rem=num%10:
sum=sum+rem:
printf ("%d",sum):
}
getch():
}

Comments

Post a Comment