Wednesday, August 21, 2013

Write a program in c to reverse the digits of a given integer


/*------------------------------------------------------------------------------------------------
Program    : Write a program in c to reverse the digits of a given integer.
Created By: JABIR DAUD PATHAN
Branch       : COMPUTER ENGINEERING
-------------------------------------------------------------------------------------------------*/

#include<stdio.h>
#include<conio.h>

void main()
 {
  int no,rem=0,cnt=0; 
  clrscr(); 
  printf("Enter any Number==>");
  scanf("%d",&no);
  printf("The Reverse number is=");
  while(no!=0)
   {
    rem=no%10;
    cnt++;
    printf("%d",rem);
    no=no/10; 
   }
  printf("\nTotal digit in given integer=%d",cnt);
  getch();
 }


/*-----------------<< OUTPUT SCREEN  >>-------------------*/


Enter any Number==>1234
The Reverse number is=4321
Total digit in given integer=4

No comments:

Post a Comment