C Program to input a string and store the ascii value of the in an integer array and print the array
#include <stdio.h>
int main()
{ char string[20]; int n, count = 0; printf("Enter the no of characters present in an array \n "); scanf("%d", &n); printf(" Enter the string of %d characters \n" , n); scanf("%s", string); while (count < n) { printf(" %c = %d\n", string[count], string[count] ); ++ count ; } return 0; } OUTPUT:-
---------------------------
Enter the no of characters present in an array 5 Enter the string of 5 characters GREEN G = 71 R = 82 E = 69 E = 69 N = 78
--------------------------------