Wednesday, May 20, 2020

Reversing the numbers in C



  • Program :

#include<stdio.h>
int main()
{
int n,a,r=0;
printf("\n----------------REVERSED NUMBER----------------"); 
printf("\nEnter any number to be reversed :");
scanf("%d",&n);
while(n>=1)
{
a=n%10;
r=r*10+a;
n=n/10;
}
printf("\nreverse : %d",r);
return 10;
}




  • Output :



No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...