How to reverse a number using goto operator in C programming!
#include <stdio.h>
#include <math.h>
void main (){
int num = 1234,lastDigit,inverse = 0;
start:
lastDigit = num % 10;
inverse = (inverse * 10) + lastDigit;
num/=10;
if(num != 0){
goto start;
}
printf("Reverse of the Number is : %d",inverse);
}
Comments
Post a Comment