Count no of digits in integer using goto statement C Program




#include <stdio.h>

int main()
{
   int n,c=0; 
    printf("\nEnter the Number : ");
    scanf("%d", &n);
    s:
    n=n/10;
    c++;
    if(n!=0)
    {
        goto s;
    }
   
 printf("\nNo of digits : %d", c);
    return 0;
}

Comments