Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

write a program to swap the alternate digits of the given number from right to left

+2 votes
asked Jun 21, 2019 by anonymous
it should use only loops and decision making

2 Answers

0 votes
answered Jun 22, 2019 by sssr


int no,rem,rev=0;

printf("enter a no");








printf("%d is reverse no");

0 votes
answered Jun 22, 2019 by bekulio (180 points)

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

#include <stdio.h>

unsigned int foo (unsigned int num);

main ()
  printf ("Hello World");

  printf ("\n reverse = %d", foo (556677));

  return 0;

unsigned int
foo (unsigned int num)
  unsigned int ret_num = 0, temp;

  while (num / 10 != 0)
      ret_num += (num % 10);
      num /= 10;
      ret_num *= 10;


  ret_num += num;

  return ret_num;
commented Jun 26, 2019 by meraj
int x,r,s=0;
printf("enter a number");
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.