# C Program to compute sum and reverse of a given integer

## sum and reverse of a given integer using c

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/*WAP to compute sum and reverse of a given integer*/ #include<stdio.h> void main() { int sum=0,rev=0,rem,n; clrscr(); printf("Enter The Integer-"); scanf("%d",&n); while(n!=0) { rem=n%10; sum=sum+rem; rev=rev*10+rem; n=n/10; } printf("The Sum Of Digits Is =%d\n",sum); printf("Reversed Number Is =%d",rev); getch(); } |

## Output

1 2 3 |
Enter The Integer-248 The Sum Of Digits Is =14 Reversed Number Is =842 |

Comments are closed, but trackbacks and pingbacks are open.