PPS Practical 18

PPS Practical 18
  • Aim: Write a program to reverse a number.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    void main()
    {
        int n,rem,rev=0;
        // clrscr();
        printf("Enter Numbers : ");
        scanf("%d",&n);
        while (n!=0){
            rem=n%10;
            rev=rev*10+rem;
            n/=10;
        }
        printf("Reverse Number is : %d",rev);
        // getch();
    }
  • Output:
  • Output of practical 18

Comments