To print reverse of five digit number





#include
#include

main()
{
int i;
long int n,n1,a,b,c;
clrscr();
printf("give five digit number ");
scanf("%ld",&n);
n1=n;
for(i=1;i<=5;i++)
{
a=n1%10;
b=n1-a;
printf("%d",a);
n1=b/10;
}
}

Related Links :

6 comments:

  1. Write a program that reads a list of integers from the keyboard and creates the following information: a. Finds and prints the sum and the average of the integers b. Finds and prints the largest and the smallest integers c. Prints a Boolean(true or false) if some of them are less than 20 d. Prints a Boolean(true or false) if all of them are between 10 and 90. The input data consist o a list of integers with a sentinel. The program must prompt the user to enter the integers, one by one, and enter the sentinel when the end of the list has been reached

    ReplyDelete
  2. #include


    main()
    {

    int i,no,a,b,c;

    printf("give five digit number ");
    scanf("%ld",&no);

    for(i=1;i<=5;i++)
    {
    a=no%10;
    no=no/10;
    printf("%d",a);

    }
    }

    ReplyDelete
  3. #include
    #include
    void main()
    {
    int num,rem,rev=0,a,i,sum=0;
    clrscr();
    printf("Enter the five digits number=");
    scanf("%d",&num);
    printf("Entered the five digits number=%d",num);
    for(i=1;i<=4;i++)
    {
    rem=num%10;
    rev=rev*10+rem;
    sum=sum+rem;
    num=num/10;

    }
    printf("\n Sum of reverse is=%d",sum);
    printf("\n Reverse number is=%d",rev);


    getch();
    }

    ReplyDelete
  4. can we print these five no in reverse order without using mod and division?

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. pls help me solve this:
    Write c program that ask the users to enter 3 integer numbers and then prints the entered number in reverse order.
    Ex.
    Enter 1st number: 5
    Enter 2nd number: 3
    Enter 3rd number: 19
    The number is reverse order: 19 35
    press any key to continue

    ReplyDelete


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!