Search C Program | nimishsoft@gmail.com

Reverse number using for loop

/* Reverse number using for loop */

#include<stdio.h>
int main()
{
    int a, s;
    printf("Enter value of a: ");
    scanf("%d",&a);
    for(s=0;a>0;a=a/10)
    {
        s = s*10;
        s = s + (a%10);   
    }
    printf("Reverse number is: %d",s);
    return 0;
}

Related Post:
Reverse number using while loop
http://cbasicprogram.blogspot.in/2012/02/reverse-number-using-while-loop.html

9 comments:

  1. only returning 621 does'nt matter what input i give........WRONG PROGRAM

    ReplyDelete
    Replies
    1. working for me
      check http://codepad.org/JIDHLUHT

      Delete
    2. Attention everyone, the file provided above is not working. I have been looking for the working file and finally found it.



      ✔️Click Here To Download http://gestyy.com/e0GAyS
      ✔️Click Here To Download

      ✔️Click Here To Download http://exe.io/XONVsO6l

      ✔️Click Here To Download


      ✔️Click Here To Download
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .

      .

      .
      .

      .

      .
      .
      .
      .

      Mn.
      ..

      .
      .
      .
      ..
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      ..
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .cx
      .sdcccxxxcxxccxcxxc

      Delete
  2. this seems a wrong program..!!!

    ReplyDelete
  3. WRITE THE C PROGRAM TO REVERSE A GIVEN NUMBER WITHOUT USING MODULO OPERATOR

    ReplyDelete
    Replies
    1. #include
      void rvrs(int arra[],int n);
      int main()
      {
      int arra[100],i,n;
      printf("How Many Element : ");
      scanf("%d",&n);
      printf("Enter Number : \n");
      for(i=0;i= 0; i--, c++)
      arra1[c] = arra[i];
      for (i = 0; i < n; i++)
      arra[i] = arra1[i];
      for (i = 0; i< n; i++)
      printf("%d\n", arra[i]);
      }

      Delete
  4. Nice program . visit more good coding program collection Click Here

    ReplyDelete