SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to find ascii value of a number
C program to find ascii value of a number
Output:
Enter a number: 1234
ASCII values of each digit in the number is:
49 50 51 52
Implementation:
/* ASCII values are limited to the following numbers only: Number ASCII Value ------------------------ 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55 8 56 9 57 */ #include
int main(void) { char s[1000]; int i=0; printf("Enter a number:\n"); scanf("%s",s); printf("ASCII values of each digit in the number is:\n"); while(s[i]) { printf("%d ",*(s+i)-'0'+48); i++; } return 0; }
PREVIOUS
NEXT
HOME