If a five digit number is input through the keyboard write a program to the reverse the number

 If a five digit number is input through the keyboard write a program to the reverse  the number.

 /* Reverse digits of a 5- digits number.*/

#include<stdio.h>

int main()

{

int n ,d5,d4,d3,d2,d1;

long int revnum;

printf("\n Enter a five digit number (less than 32767):");

scanf("%d",&n);

d5=n%10;                //5th digit

n=n/10;                      //remaining digits

d4=n%10;                     //4th digits

n=n/10;                    //remaining digit

d3=n%10;                              //3th digits

n=n/10;                    //remaining digits

d2=n%10;                                  //2th digits

n=n/10;                                //remaining digits

d1=n%10;                            //1th digits

 revnum=d5*10000+d4*1000+d3*100+d2*10+d1;

//specifier %Id is used for a printing a long integer

printf("The reverse number is %1d\n",revnum);

return 0 ;

output--- Enter a five digit number (less than 32767):  1 2 3 4 5

                     The reverse number is: 5 4 3 2 1


 
 

 

paper of size A0 has dimensions 1189 mm X 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8.

(click the link--below--

https://www.blogger.com/u/2/blog/post/edit/5851128460296589847/7194292002535781059

 

If lengths of three sides of a triangle are input through the keyboard write a program to find the area of triangle.

(click the link--below-- 

if a five digit number is input through the keyboard write a program to calculate the sum of its digits.(Hints:Use the modulus operator %)

https://www.blogger.com/u/2/blog/post/edit/5851128460296589847/7194292002535781059


 

Comments

Popular posts from this blog

If lengths of three sides of a tringle are input through the keyboard write a program to find the area of tringle.

the length and breadth of a rectangle and radius of a circle are input through the keyboard. write a program to calculate the area and perimeter of the rectangle, and the area and circumference of the circle

paper of size A0 has dimensions 1189 mmx 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8.