pages

Wednesday, 9 June 2021

c-program to find the reverse of the number by using function | c-programming

Program to find the reverse of the number 

In this program we will now  find the  reverser of the number by using function by taking the values from the user in c-programming.

#include<stdio.h>
#include<stdio.h>
int reverse(int);
void main()
{
         int a,num;
         printf("enter the number:-");
         scanf("%d",&a);
         num=reverse(a);
         printf("\n the reverse of the number is %d",num);
         getch();
}
int reverse(int n)
{
         int rev=0,i,x;
         while(n!=0){
                  x=n%10;
                  rev=rev*10+x;
                  n=n/10;
         }
         return(rev);
}

Output:-



For more c-programming















No comments:

Post a Comment