Reverse the given number using in C program language,Reverse the number digits,reverse the given number,reverse the given number in C,reverse the given number using C language,reverse the given number in C program language,C reverse the number,reverse of the given number,C program reverse the given number,reverse of the given number in C
Reverse of the given number in C
Program is developed at below for this logic.
#include<stdio.h>
main()
{
int n,rem,rev=0;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
rem = n%10;
sum = (rev*10) + rem;
n = n/10;
}
printf("After reverse the numbers %d\n",sum);
}
Output:-
Enter the number
1234
After reverse the number 4321
Reverse of the given number in C
Program is developed at below for this logic.
#include<stdio.h>
main()
{
int n,rem,rev=0;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
rem = n%10;
sum = (rev*10) + rem;
n = n/10;
}
printf("After reverse the numbers %d\n",sum);
}
Output:-
Enter the number
1234
After reverse the number 4321
#include
ReplyDeletemain()
{
int n,rem,sum=0;
printf("Enter the number\n");
scanf("%d",&n);
while(n>0)
{
rem = n%10;
sum = (sum*10) + rem;
n = n/10;
}
printf("After reversing the numbers %d\n",sum);
}
Output:-
Enter the number
1234
After reversing the number 4321