move to repo.or.cz
[letusc.git] / ch2 / exercises1 / ex5.c
blobfa0898cd4186213d3683568b876a17e0e70242a7
1 /* reverse a five digit number and compare them for equality */
3 #include<stdio.h>
4 #include<math.h>
6 //int main()
7 //{
8 // long num,num_rev=0;
9 // int temp;
10 // printf("Enter the five digit number: ");
11 // scanf("%ld",&num);
13 // /*reverse the number */
14 //
15 // temp = num%10;
16 // num_rev = num_rev + (temp*pow(10,4));
17 // num = num/10;
19 // temp = num%10;
20 // num_rev = num_rev + (temp*pow(10,3));
21 // num = num/10;
23 // temp = num%10;
24 // num_rev = num_rev + (temp*pow(10,2));
25 // num = num/10;
27 // temp = num%10;
28 // num_rev = num_rev + (temp*pow(10,1));
29 // num = num/10;
31 // temp= num%10;
32 // num_rev = num_rev + (temp*pow(10,0));
33 // printf("The reverse is %ld\n",num_rev);
34 //
35 // /*check for equality*/
36 // if(num==num_rev)
37 // printf("Both reverse and original are equal\n");
38 // else
39 // printf("Both are not equal\n");
40 // return 0;
41 //}