Filled Under: ,

C program to reverse a number.

C program to reverse a number

C program to reverse a number

 In this program, I have discussed about the C program to reverse a number


#include<stdio.h>
#include<math.h>
int main()
{ int n,k,a=0,rev=0;
printf("Enter the number");
scanf("%d",&n);
while(n>0)
{k=n%10;
n=n/10;
rev=(rev*10)+k;
}
printf("%d",rev);
}

Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.

0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved