C Program to Reverse a Number



In this program we will print the reverse of a given number.



  1. //C Program to reverse a number
  2. #include<stdio.h>
  3. #include <stdio.h>
  4. int main()
  5. {
  6. int n, reverse = 0, rem;
  7. printf("Enter a number: ");
  8. scanf("%d", &n);
  9. while(n != 0)
  10. {
  11. rem = n%10;
  12. reverse = reverse*10 + rem;
  13. n /= 10;
  14. }
  15. printf("Reverse of the number is = %d", reverse);
  16. return 0;
  17. }

Output
Output!
download android app

Popular C Examples









codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube