Simple C Program reverse digits of number using function
int main()
{
int a;
printf("Enter a number :");
scanf("%d",&a);
int b=reversedigit(a);
printf("\nreverse= %d",b);
getch();
}
reversedigit(int x)
{
int y=0;
while(x)
{
y=y*10+x%10;
x=x/10;
}
return y;
}
No comments:
Post a Comment