c programming

Wednesday, 19 August 2015

Programming in C to reverse a number

#include<stdio.h>
#include<conio.h>
void main()
{
int a,r=0,s;
clrscr();
printf("\nEnter the number which is to be reversed (upto 4 numbers only):");
scanf("%d",&a);
while(a>0)
{
s=a%10;
a=a-s;
r=(r*10)+s;
a=a/10;
}
printf("\n Reversed number: %d",r);
getch();
}
Posted by Unknown at 05:15
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

Unknown
View my complete profile

Blog Archive

  • ▼  2015 (15)
    • ▼  August (15)
      • Codes for a record entry project
      • Why we learn C language today?
      • C Basic
      • Programming in C to test that the given number is ...
      • Programming in C to find the cube of any number
      • Programming in C to find the square of the given n...
      • Programming in C to reverse a number
      • Programming in C to convert a letter from upper to...
      • Programming in C to find the sum of the given number
      • Programming in C to convert the Decimal number to ...
      • Programming in C to find the factorial of given nu...
      • Structure Of A C Program
      • Programming in C to find the name of the day of th...
      • Programming in C to find the value of any variable...
      • History of C
Travel theme. Powered by Blogger.