Addition of Digits of Given No C Program
This program specially for separating the digits from given more than 2 digit no and add it together . This logic mainly useful at the time of reversing the digit of given no.
/* Program For Adding digits of No*/ #include<stdio.h> int main() { int no,temp; printf("\nEnter no\n"); scanf("%d",&no); int bs=no; int count=; while(no) { temp =no%10; sum=sum+temp; no=no/10; } printf("Sum of digit of this no %d \t :%d\n",bs,sum); return 0; }
0 comments:
Post a Comment