Reverse The Number Using Goto Statement C Program



#include <stdio.h>

int main()
{
    int n,c=0,r,f=1, i=1,t,rsum=0;
 
    printf("\nEnter the number : ");
    scanf("%d", &n);
    t=n;
    s:
    n=n/10;
    c++;
    if(n!=0)
    {
    goto s;
}
f:
f=f*10;
i++;
if(i<c)
{
    goto f;
}
n=t;
e:
r=n%10;
n=n/10;
rsum=rsum+(r*f);
f=f/10;
if(n!=0)
{
goto e;
}
printf("\nReverse value : %d", rsum);
    return 0;
}

Comments