#include<stdio.h>
#include<conio.h>
void main()
{
int no,rem,rev=0;
clrscr();
printf("Enter a no:");
scanf("%d",&no);
while(no>0)
{
rem=no%10;
rev=(rem*10)+rev;
no=no/10;
}
printf("Reversed number =%d",rev);
getch();
}
Subscribe to:
Post Comments (Atom)
Related Post
Array:
String functions:
General (Loops-for/while)
sry tosay but this is not the correct program as when i tried it , it is giving wrong output, it is not showing the reversed no. but some different pattern
ReplyDeleteI think inside the while loop
ReplyDeleteRev=
(Rev*10)+rem
Good
ReplyDeleteHere is a link for C/C++ programs and pointer programs. This may be useful for you.
C Programs
C++ Programs
C++ Program to Reverse a Number
ReplyDeleteReverse of number means reverse the position of all digits of any number. For example reverse of 536 is 635
C++ Program to Reverse a Strings
ReplyDeleteReverse a String means reverse the position of all character of String. You can use swapping concept to reverse any string in c++.
Nice program . visit more good coding program collection Click Here
ReplyDelete