-->

NEB26:program to reverse a number using function reverse()

//program to reverse a number using function reverse()
#include<stdio.h>
#include<conio.h>
void reverse();
void main()
{
prinf("the output is\n");
reverse();
getch();
}
void reverse()
{
int num;
int rem;
printf("enter a number\n");
scanf("%d",&num);
while(num!=0)
{
 rem=num%10;
    printf("%d",rem);
num=num/10;
}
------------------------
or simply we can also use strrev() function.



No comments:

Post a Comment