Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Saturday, 9 March 2013

C PROGRAM: TO REVERSE A NUMBER

CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
 int num,temp,rev=0;
 clrscr();
 ab:
 printf("Enter a number: ");
 scanf("%d",&num);
 if(num<10)
 {
  printf("Please enter a number which is above 9\n\n");
  goto ab;
 }
 while(num>0)
 {
  temp=num%10;
  rev=temp+10*rev;
  num=num/10;
 }
 printf("\n\nReversed number: %d",rev);
 getch();
}


CODING

OUTPUT


For any query or suggestion please comment below...

No comments:

Post a comment