C Program To Convert Character To ASCII and To Find The Sum of Digits of ASCII Value
C Program To Convert Character To ASCII and To Find The Sum of Digits of ASCII Value
Program: #include<stdio.h> #include<conio.h> #include<ctype.h> void main() { char ch; int asc; int sum = 0; clrscr(); printf("Enter a character : "); scanf("%c", &ch); asc = toascii(ch); printf("\nThe ASCII value of %c is %d", ch, asc); while (asc > 0) { sum = sum + (asc % 10); asc = asc / 10; } printf("\nThe sum is %d", sum); getch(); } More useful programs @ http://www.gethugames.in/blog/