Convert a string to ASCII in c





Program to convert string into ASCII values in c programming language:

#include<stdio.h>

int main(){
  
    char str[100];
    int i=0;

    printf("Enter any string: ");
    scanf("%s",str);

    printf("ASCII values of each characters of given string: ");
    while(str[i])
         printf("%d ",str[i++]);
        
   
    return 0;
}

Sample Output:
Enter any string: cquestionbank.blogspot.com
ASCII values of each characters of given string: 99 113 117 101 115 116 105 111 110 98 97 110 107 46 98 108 111 103 115 112 111 116 46 99 111 109





3. Write a c program to delete the all consonants from given string.
Post a Comment