Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Reverse a number using while loop | C program

#include <stdio.h>
int main()
{
 int no, r = 0;
 
 printf("Type a number: ");
 scanf("%d",&no);
 
 while (no > 0)
 {
  r = r * 10;
  r = r + no%10;
  no = no/10;
 }
 
 printf("Reversed number is = %d: ", r);
 return 0;
}
Bhuvan Arora

No comments:

Amazing Deal !