Sum of Digit Using Goto Statement C Program on June 17, 2018 Get link Facebook X Pinterest Email Other Apps #include <stdio.h> int main() { int n, sum=0, r; printf("\nEnter the number : "); scanf("%d" , &n); s: r=n%10; n=n/10; sum=sum+r; if(n!=0) { goto s; (will go to s and run again) } printf("\nSum = %d", sum); return 0; } Comments
Comments
Post a Comment