#include<stdio.h>intmain(){intn,temp;printf("———————————————————————————————————————————");printf("\nProgram to reverse a given number");printf("\n———————————————————————————————————————————");printf("\nEnter the number ");scanf("%d",&n);if(n<10){printf("\nUnable to reverse the negative and single-digit number.");}else{printf("\nThe reverse number is ");while(n/10!=0){temp=n%10;n=n/10;printf("%d",temp);}printf("%d",n);}printf("\n———————————————————————————————————————————\n");return0;}
Output
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to reverse a given number
———————————————————————————————————————————
Enter the number 5
Unable to reverse the negative and single-digit number.
———————————————————————————————————————————
kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to reverse a given number
———————————————————————————————————————————
Enter the number 65535
The reverse number is 53556
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.