0 votes
127 views
in C programming by (98.9k points)
edited
C Program to Reverse Digits of a Number

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
#include <stdio.h>
#include <conio.h>
 
int main(){
    int number, reverse = 0, rightDigit;
    printf("Enter a number \n");
    scanf("%d", &number);
    while(number != 0){
        rightDigit = number % 10;
        reverse = (reverse * 10) + rightDigit;
        number = number/10;
    }    
    printf("Reversed number : %d\n", reverse);
     
    getch();
    return 0;
}

 

Related questions

0 votes
1 answer 165 views
0 votes
1 answer 118 views
0 votes
1 answer 211 views
asked Jul 20, 2022 in C programming by Doubtly (98.9k points)
0 votes
1 answer 120 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

554 users

...