Search
 
SCRIPT & CODE EXAMPLE
 

C

Reverse integer in c

#include <stdio.h>

int main() {

  int n, reverse = 0, remainder;

  printf("Enter an integer: ");
  scanf("%d", &n);

  while (n != 0) {
    remainder = n % 10;
    reverse = reverse * 10 + remainder;
    n /= 10;
  }

  printf("Reversed number = %d", reverse);

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: divide a linked list into three parts based on their position mod 3. 
C :: rand in c 
C :: instller acrobat ous ubuntu 
C :: Battlefield4u.com 
C :: print integer to stdout using write or putchar? 
C :: pointer operator 
C :: Computers round off numbers 
C :: extended euclidean algorithm to find x and y 
C :: clipboard lib 
C :: disable gnu++11 option 
C :: check if string is number c 
C :: convert char to int ascii in c function 
C :: pdo crud 
C :: Trier lexicographiquement en c 
C :: read from text file in c 
C :: C program determines the height status for heights in cm 
C :: python to c converter online free 
C :: captive portal esp8266 
C :: How to get the number of characters in a string without using strlen function 
C :: how to write 2d array from bin file in c 
C :: wordpress clean name spaces 
C :: C do...while loop 
C :: how to find the elements in array c coding 
Dart :: how to diable flutter for web 
Dart :: dart string remove first character 
Dart :: flutter switch color 
Dart :: raised button deprecated flutter 
Dart :: taskkill dart 
Dart :: mark as deprecated dart 
Dart :: flutter snackbar width 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =